Skip to content

Сarthage and Apple silicone support. #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions OAuth2Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "942FFCD512315E0A00E6C65E"
BuildableName = "OAuth2Client.framework"
BlueprintName = "OAuth2Client.framework"
ReferencedContainer = "container:OAuth2Client.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "942FFCD512315E0A00E6C65E"
BuildableName = "OAuth2Client.framework"
BlueprintName = "OAuth2Client.framework"
ReferencedContainer = "container:OAuth2Client.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
16 changes: 8 additions & 8 deletions Sources/OAuth2Client/NXOAuth2AccountStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
61 changes: 31 additions & 30 deletions Sources/OAuth2Client/NXOAuth2Connection.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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