diff --git a/OAuth2Client.xcodeproj/project.pbxproj b/OAuth2Client.xcodeproj/project.pbxproj index 7a94c0f2..1f76e650 100644 --- a/OAuth2Client.xcodeproj/project.pbxproj +++ b/OAuth2Client.xcodeproj/project.pbxproj @@ -603,7 +603,6 @@ 1DEB922308733DC00010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = c99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -617,7 +616,6 @@ 1DEB922408733DC00010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -631,7 +629,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; @@ -661,7 +658,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; diff --git a/OAuth2Client.xcodeproj/xcshareddata/xcschemes/OAuth2Client.framework.xcscheme b/OAuth2Client.xcodeproj/xcshareddata/xcschemes/OAuth2Client.framework.xcscheme new file mode 100644 index 00000000..87ec5d0f --- /dev/null +++ b/OAuth2Client.xcodeproj/xcshareddata/xcschemes/OAuth2Client.framework.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OAuth2Client.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/OAuth2Client.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/OAuth2Client.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Sources/OAuth2Client/NXOAuth2AccountStore.m b/Sources/OAuth2Client/NXOAuth2AccountStore.m index dde5b927..4406f032 100644 --- a/Sources/OAuth2Client/NXOAuth2AccountStore.m +++ b/Sources/OAuth2Client/NXOAuth2AccountStore.m @@ -373,12 +373,12 @@ - (NXOAuth2TrustedCertificatesHandler)trustedCertificatesHandlerForAccountType:( #pragma mark Handle OAuth Redirects -- (BOOL)handleRedirectURL:(NSURL *)aURL +- (BOOL)handleRedirectURL:(NSURL *)aURL forAccountType:(NSString *)accountType { - return [self handleRedirectURL:aURL error:nil]; + return [self handleRedirectURL:aURL forAccountType:accountType error:nil]; } -- (BOOL)handleRedirectURL:(NSURL *)aURL error: (NSError**) error +- (BOOL)handleRedirectURL:(NSURL *)aURL forAccountType:(NSString *)accountType error: (NSError**) error { __block NSURL *fixedRedirectURL = nil; NSSet *accountTypes; @@ -401,12 +401,12 @@ - (BOOL)handleRedirectURL:(NSURL *)aURL error: (NSError**) error }]; } - for (NSString *accountType in accountTypes) { - NXOAuth2Client *client = [self pendingOAuthClientForAccountType:accountType]; - if ([client openRedirectURL:fixedRedirectURL error:error]) { - return YES; - } + NXOAuth2Client *client = [self pendingOAuthClientForAccountType:accountType]; + + if ([client openRedirectURL:fixedRedirectURL error:error]) { + return YES; } + return NO; } diff --git a/Sources/OAuth2Client/NXOAuth2Connection.m b/Sources/OAuth2Client/NXOAuth2Connection.m index b095572c..00ab46e3 100644 --- a/Sources/OAuth2Client/NXOAuth2Connection.m +++ b/Sources/OAuth2Client/NXOAuth2Connection.m @@ -421,7 +421,8 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon && client.accessToken.refreshToken != nil && authenticateHeader && ([authenticateHeader rangeOfString:@"invalid_token"].location != NSNotFound || - [authenticateHeader rangeOfString:@"expired_token"].location != NSNotFound )) + [authenticateHeader rangeOfString:@"invalid_grant"].location != NSNotFound || + [authenticateHeader rangeOfString:@"expired_token"].location != NSNotFound)) { [self cancel]; [client refreshAccessTokenAndRetryConnection:self]; @@ -570,34 +571,34 @@ - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectio return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; } -- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; -{ - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - NSString *hostname = challenge.protectionSpace.host; - - NXOAuth2TrustMode effectiveTrustMode = NXOAuth2TrustModeSystem; - if ([self.trustDelegate respondsToSelector:@selector(connection:trustModeForHostname:)]) { - effectiveTrustMode = [self.trustDelegate connection:self trustModeForHostname:hostname]; - } - BOOL shouldTrustCerificate = [self trustsAuthenticationChallenge:challenge - forHostname:hostname - withTrustMode:effectiveTrustMode]; - - if (shouldTrustCerificate) { - [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] - forAuthenticationChallenge:challenge]; - } else { - [challenge.sender cancelAuthenticationChallenge:challenge]; - } - - } else { - - if ( [challenge previousFailureCount] == 0 ) { - [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; - } else { - [[challenge sender] cancelAuthenticationChallenge:challenge]; - } - } -} +//- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; +//{ +// if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { +// NSString *hostname = challenge.protectionSpace.host; +// +// NXOAuth2TrustMode effectiveTrustMode = NXOAuth2TrustModeSystem; +// if ([self.trustDelegate respondsToSelector:@selector(connection:trustModeForHostname:)]) { +// effectiveTrustMode = [self.trustDelegate connection:self trustModeForHostname:hostname]; +// } +// BOOL shouldTrustCerificate = [self trustsAuthenticationChallenge:challenge +// forHostname:hostname +// withTrustMode:effectiveTrustMode]; +// +// if (shouldTrustCerificate) { +// [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] +// forAuthenticationChallenge:challenge]; +// } else { +// [challenge.sender cancelAuthenticationChallenge:challenge]; +// } +// +// } else { +// +// if ( [challenge previousFailureCount] == 0 ) { +// [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; +// } else { +// [[challenge sender] cancelAuthenticationChallenge:challenge]; +// } +// } +//} @end