Skip to content

Commit

Permalink
[jivesoftware#6] using NSSet for auth scheme support check
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Dodatko committed Jul 30, 2018
1 parent a02c677 commit 3afaaeb
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,19 @@ - (void)viewDidLoad {
#pragma mark - JAHPAuthenticatingHTTPProtocolDelegate

- (BOOL)authenticatingHTTPProtocol:(JAHPAuthenticatingHTTPProtocol *)authenticatingHTTPProtocol canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
BOOL canAuthenticate = [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic];

NSArray* interceptedAuthMethods =
@[
NSURLAuthenticationMethodHTTPBasic
, NSURLAuthenticationMethodHTTPDigest
, NSURLAuthenticationMethodNTLM
];

NSSet* interceptedAuthMethodsSet = [NSSet setWithArray: interceptedAuthMethods];

BOOL canAuthenticate =
[interceptedAuthMethodsSet containsObject: protectionSpace.authenticationMethod];

return canAuthenticate;
}

Expand Down

0 comments on commit 3afaaeb

Please sign in to comment.