Skip to content

Commit

Permalink
Merge pull request #252 from AzureAD/release/1.0.3
Browse files Browse the repository at this point in the history
Release/1.0.3 to master
  • Loading branch information
unpluggedk authored Sep 28, 2018
2 parents 3c64ba4 + b442df0 commit 252ae5f
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion IdentityCore/src/oauth2/aad_v2/MSIDAADV2Oauth2Factory.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (BOOL)verifyResponse:(MSIDAADV2TokenResponse *)response

if (!result)
{
if (response.error)
if (response.error && error)
{
*error = MSIDCreateError(MSIDOAuthErrorDomain,
response.oauthErrorCode,
Expand Down
2 changes: 1 addition & 1 deletion IdentityCore/src/util/NSString+MSIDExtensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ + (NSString *)msidHexStringFromData:(NSData *)data

if (!charBytes) return nil;
NSUInteger dataLength = data.length;
NSMutableString *result = [NSMutableString stringWithCapacity:dataLength];
NSMutableString *result = [NSMutableString stringWithCapacity:dataLength*2];

for (int i = 0; i < dataLength; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ - (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavig
[self webAuthFailWithError:error];
}

- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
{
[self webAuthFailWithError:error];
}

- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(ChallengeCompletionHandler)completionHandler
{
NSString *authMethod = [challenge.protectionSpace.authenticationMethod lowercaseString];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#import "UIApplication+MSIDExtensions.h"
#import "MSIDAppExtensionUtil.h"

static WKWebViewConfiguration *s_webConfig;

@interface MSIDWebviewUIController ( )
{
UIActivityIndicatorView *_loadingIndicator;
Expand All @@ -40,6 +42,14 @@ @interface MSIDWebviewUIController ( )

@implementation MSIDWebviewUIController

+ (void)initialize
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
s_webConfig = [WKWebViewConfiguration new];
});
}

- (id)initWithContext:(id<MSIDRequestContext>)context
{
self = [super init];
Expand Down Expand Up @@ -86,8 +96,7 @@ - (BOOL)loadView:(NSError **)error;
[rootView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];

// Prepare the WKWebView
WKWebViewConfiguration *webConfiguration = [WKWebViewConfiguration new];
WKWebView *webView = [[WKWebView alloc] initWithFrame:rootView.frame configuration:webConfiguration];
WKWebView *webView = [[WKWebView alloc] initWithFrame:rootView.frame configuration:s_webConfig];
[webView setAccessibilityIdentifier:@"MSID_SIGN_IN_WEBVIEW"];

// Customize the UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#import <SecurityInterface/SFChooseIdentityPanel.h>
#import "MSIDCertificateChooser.h"
#import <MSIDNotifications.h>

@implementation MSIDCertificateChooserHelper
{
Expand Down Expand Up @@ -61,7 +62,7 @@ - (void)beginSheet:(NSArray *)identities
identities:identities
message:message];

//[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webAuthDidFail:) name:ADWebAuthDidFailNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webAuthDidFail:) name:MSIDNotifications.webAuthDidFailNotificationName object:nil];
}

- (void)showCertSelectionSheet:(NSArray *)identities
Expand All @@ -87,10 +88,9 @@ - (void)sheetDidEnd:(__unused NSWindow *)window
}

SecIdentityRef identity = _panel.identity;
_panel = nil;
_completionHandler(identity);
_completionHandler = nil;
//[[NSNotificationCenter defaultCenter] removeObserver:self name:ADWebAuthDidFailNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MSIDNotifications.webAuthDidFailNotificationName object:nil];
}

- (void)webAuthDidFail:(__unused NSNotification *)aNotification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define DEFAULT_WINDOW_WIDTH 420
#define DEFAULT_WINDOW_HEIGHT 650

static WKWebViewConfiguration *s_webConfig;

@interface MSIDWebviewUIController ( ) <NSWindowDelegate>
{
NSProgressIndicator *_loadingIndicator;
Expand All @@ -37,6 +39,14 @@ @interface MSIDWebviewUIController ( ) <NSWindowDelegate>

@implementation MSIDWebviewUIController

+ (void)initialize
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
s_webConfig = [WKWebViewConfiguration new];
});
}

- (id)initWithContext:(id<MSIDRequestContext>)context
{
self = [super init];
Expand All @@ -60,8 +70,7 @@ - (BOOL)loadView:(NSError **)error
NSView *rootView = window.contentView;

// Prepare the WKWebView
WKWebViewConfiguration *webConfiguration = [WKWebViewConfiguration new];
WKWebView *webView = [[WKWebView alloc] initWithFrame:rootView.frame configuration:webConfiguration];
WKWebView *webView = [[WKWebView alloc] initWithFrame:rootView.frame configuration:s_webConfig];
[webView setAccessibilityIdentifier:@"MSID_SIGN_IN_WEBVIEW"];

// Customize the UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ - (instancetype)initWithURL:(NSURL *)url
{
_startURL = url;
_context = context;
_callbackURLScheme = callbackURLScheme;
}

return self;
Expand Down
8 changes: 5 additions & 3 deletions IdentityCore/src/workplacejoin/mac/MSIDWorkPlaceJoinUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ + (MSIDRegistrationInformation *)getRegistrationInformation:(id<MSIDRequestConte
}


+ (void)copyCertificate:(SecCertificateRef __nullable * __nonnull)certificate
+ (BOOL)copyCertificate:(SecCertificateRef __nullable * __nonnull)certificate
identity:(SecIdentityRef __nullable * __nonnull)identity
issuer:(NSString * __nullable * __nonnull)issuer
context:(id<MSIDRequestContext>)context
Expand Down Expand Up @@ -170,7 +170,7 @@ + (void)copyCertificate:(SecCertificateRef __nullable * __nonnull)certificate
// If there's no certificate in the keychain, adError won't be set since this isn't an error condition.
if (!*certificate)
{
return;
return NO;
}

// In OS X the shared access group cannot be set, so the search needs to be more
Expand Down Expand Up @@ -199,7 +199,7 @@ + (void)copyCertificate:(SecCertificateRef __nullable * __nonnull)certificate

CFRelease(result);

return;
return YES;

_error:

Expand All @@ -216,6 +216,8 @@ + (void)copyCertificate:(SecCertificateRef __nullable * __nonnull)certificate
*certificate = nil;

*issuer = nil;

return NO;
}


Expand Down

0 comments on commit 252ae5f

Please sign in to comment.