Skip to content

Commit

Permalink
Remove System Account auth (#964)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #964

The System Account login behavior has not been supported for several iOS versions and is due to be removed.

Reviewed By: codytwinton, dreamolight

Differential Revision: D14492788

fbshipit-source-id: 675f044df9ebdf3a62164c9a6976f2d94ca07068
  • Loading branch information
robtimp authored and facebook-github-bot committed Mar 19, 2019
1 parent 5b87471 commit 40edfef
Show file tree
Hide file tree
Showing 22 changed files with 14 additions and 1,094 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Dot notation for access to properties
- Collections/Dictionaries became non null when at all possible
- Class creation methods become Swift inits
- Deprecated `FBSDKLoginBehaviorSystemAccount`
- Deprecated `[FBSDKLoginManager renewSystemCredentials] `

### Removed

Expand Down
12 changes: 0 additions & 12 deletions FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@
814AC8501D1B528900D61E6C /* FBSDKLogo.h in Headers */ = {isa = PBXBuildFile; fileRef = 893F44931A6444DF001DB0B6 /* FBSDKLogo.h */; };
814AC8511D1B528900D61E6C /* FBSDKGraphRequestMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DF2A3FD1A70572B00DFB2FD /* FBSDKGraphRequestMetadata.h */; };
814AC8521D1B528900D61E6C /* FBSDKPaymentObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC14A1A8D236200BE8BA4 /* FBSDKPaymentObserver.h */; };
81B71D001D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */; };
81B71D011D19C87400933E93 /* FBSDKGraphRequestPiggybackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DA81B281AA65FA200B9FE0B /* FBSDKGraphRequestPiggybackManager.m */; };
81B71D021D19C87400933E93 /* FBSDKAppEventsStateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D0BC15E1A8D428700BE8BA4 /* FBSDKAppEventsStateManager.m */; };
81B71D031D19C87400933E93 /* FBSDKServerConfigurationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 89830F2A1A7805D100226ABB /* FBSDKServerConfigurationManager.m */; };
Expand Down Expand Up @@ -296,7 +295,6 @@
81B71D521D19C87400933E93 /* FBSDKBridgeAPIProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 894C0AF21A6F21A1009137EF /* FBSDKBridgeAPIProtocol.h */; };
81B71D531D19C87400933E93 /* FBSDKGraphErrorRecoveryProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD50A3A1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; };
81B71D551D19C87400933E93 /* FBSDKBase64.h in Headers */ = {isa = PBXBuildFile; fileRef = 894C0B0F1A7021F8009137EF /* FBSDKBase64.h */; };
81B71D561D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */; };
81B71D571D19C87400933E93 /* FBSDKAppEventsUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC1591A8D427800BE8BA4 /* FBSDKAppEventsUtility.h */; };
81B71D581D19C87400933E93 /* FBSDKAppEvents+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0BC1531A8D23DB00BE8BA4 /* FBSDKAppEvents+Internal.h */; };
81B71D591D19C87400933E93 /* FBSDKErrorConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D3AF44E1A9EA4BE00EEF724 /* FBSDKErrorConfiguration.h */; };
Expand Down Expand Up @@ -606,8 +604,6 @@
9DD3FEE11D62454D00D35472 /* FBSDKURLSessionTask.m in Sources */ = {isa = PBXBuildFile; fileRef = EA4CF23E1D344BFC007AA2EB /* FBSDKURLSessionTask.m */; };
9DD50A3C1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD50A3A1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; };
9DD50A3D1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD50A3B1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.m */; };
9DD696EE1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */; };
9DD696EF1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */; };
9DDC11281BEC412C00A88306 /* FBSDKIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 891687D11AB33CA200F55364 /* FBSDKIcon.m */; };
9DDC11291BEC413000A88306 /* FBSDKIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 891687D01AB33CA200F55364 /* FBSDKIcon.h */; };
9DDC112A1BEC413900A88306 /* FBSDKLogo.m in Sources */ = {isa = PBXBuildFile; fileRef = 893F44941A6444DF001DB0B6 /* FBSDKLogo.m */; };
Expand Down Expand Up @@ -1057,8 +1053,6 @@
9DC658A11A6EE7E200B85AAF /* FBSDKGraphRequestBody.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKGraphRequestBody.m; sourceTree = "<group>"; };
9DD50A3A1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKGraphErrorRecoveryProcessor.h; sourceTree = "<group>"; };
9DD50A3B1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKGraphErrorRecoveryProcessor.m; sourceTree = "<group>"; };
9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKSystemAccountStoreAdapter.h; sourceTree = "<group>"; };
9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKSystemAccountStoreAdapter.m; sourceTree = "<group>"; };
9DE1F3CB1A89D9CD00B54D98 /* FBSDKKeychainStoreViaBundleID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBSDKKeychainStoreViaBundleID.h; sourceTree = "<group>"; };
9DE1F3CC1A89D9CD00B54D98 /* FBSDKKeychainStoreViaBundleID.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSDKKeychainStoreViaBundleID.m; sourceTree = "<group>"; };
9DE6C46D1AAF6E2800EC4C99 /* FBSDKProfile+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FBSDKProfile+Internal.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1298,8 +1292,6 @@
ADEA17721B7ECA1A0070EDC0 /* FBSDKMonotonicTime.m */,
9DE6C46D1AAF6E2800EC4C99 /* FBSDKProfile+Internal.h */,
9DA830421A699A2200770955 /* FBSDKSettings+Internal.h */,
9DD696EC1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h */,
9DD696ED1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m */,
89D05A931AA0E89B00609300 /* FBSDKTriStateBOOL.h */,
89D05A941AA0E89B00609300 /* FBSDKTriStateBOOL.m */,
C5696FA1209CCEB3009C931F /* FBSDKSwizzler.h */,
Expand Down Expand Up @@ -1878,7 +1870,6 @@
81B71D531D19C87400933E93 /* FBSDKGraphErrorRecoveryProcessor.h in Headers */,
52963A89215992F400C7B252 /* FBSDKAppLinkReturnToRefererController.h in Headers */,
81B71D551D19C87400933E93 /* FBSDKBase64.h in Headers */,
81B71D561D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.h in Headers */,
81B71D571D19C87400933E93 /* FBSDKAppEventsUtility.h in Headers */,
81B71D581D19C87400933E93 /* FBSDKAppEvents+Internal.h in Headers */,
9D28F1941DB14DBB0057D709 /* FBSDKImageDownloader.h in Headers */,
Expand Down Expand Up @@ -1989,7 +1980,6 @@
C5696F93209BBC35009C931F /* FBSDKEventBinding.h in Headers */,
9DD50A3C1A9BBA1B0088AAAA /* FBSDKGraphErrorRecoveryProcessor.h in Headers */,
894C0B111A7021F8009137EF /* FBSDKBase64.h in Headers */,
9DD696EE1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.h in Headers */,
9D0BC15B1A8D427800BE8BA4 /* FBSDKAppEventsUtility.h in Headers */,
9D0BC1541A8D23DB00BE8BA4 /* FBSDKAppEvents+Internal.h in Headers */,
9D28F1931DB14DBB0057D709 /* FBSDKImageDownloader.h in Headers */,
Expand Down Expand Up @@ -2542,7 +2532,6 @@
buildActionMask = 2147483647;
files = (
EA8D50491D356BDC00622F03 /* FBSDKURLSessionTask.m in Sources */,
81B71D001D19C87400933E93 /* FBSDKSystemAccountStoreAdapter.m in Sources */,
81B71D011D19C87400933E93 /* FBSDKGraphRequestPiggybackManager.m in Sources */,
81B71D021D19C87400933E93 /* FBSDKAppEventsStateManager.m in Sources */,
81B71D031D19C87400933E93 /* FBSDKServerConfigurationManager.m in Sources */,
Expand Down Expand Up @@ -2634,7 +2623,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9DD696EF1AAADE4000838AF2 /* FBSDKSystemAccountStoreAdapter.m in Sources */,
9DA81B2A1AA65FA200B9FE0B /* FBSDKGraphRequestPiggybackManager.m in Sources */,
9D0BC1601A8D428700BE8BA4 /* FBSDKAppEventsStateManager.m in Sources */,
89830F2C1A7805D100226ABB /* FBSDKServerConfigurationManager.m in Sources */,
Expand Down
21 changes: 0 additions & 21 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ - (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request deleg
case FBSDKGraphRequestErrorRecoverable :
if ([request.tokenString isEqualToString:[FBSDKAccessToken currentAccessToken].tokenString]) {
_recoveryAttempter = error.recoveryAttempter;
BOOL isLoginRecoveryAttempter = [_recoveryAttempter isKindOfClass:NSClassFromString(@"_FBSDKLoginRecoveryAttempter")];

// Set up a block to do the typical recovery work so that we can chain it for ios auth special cases.
// the block returns YES if recovery UI is started (meaning we wait for the alertviewdelegate to resume control flow).
Expand All @@ -72,26 +71,6 @@ - (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request deleg
return NO;
};

if ([request.tokenString isEqualToString:[FBSDKSystemAccountStoreAdapter sharedInstance].accessTokenString] &&
isLoginRecoveryAttempter) {
// special system auth case: if user has granted permissions we can simply renew. On a successful
// renew, treat this as immediately recovered without the standard alert prompty.
// (for example, this can repair expired tokens seamlessly)
[[FBSDKSystemAccountStoreAdapter sharedInstance]
renewSystemAuthorization:^(ACAccountCredentialRenewResult result, NSError *renewError) {
dispatch_async(dispatch_get_main_queue(), ^{
if (result == ACAccountCredentialRenewResultRenewed) {
[self.delegate processorDidAttemptRecovery:self didRecover:YES error:nil];
self.delegate = nil;
} else if (!standardRecoveryWork()) {
[self.delegate processorDidAttemptRecovery:self didRecover:NO error:self->_error];
};
});
}];
// short-circuit YES so that the renew callback resumes the control flow.
return YES;
}

return standardRecoveryWork();
}
return NO;
Expand Down
31 changes: 1 addition & 30 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -801,43 +801,14 @@ - (void)processResultBody:(NSDictionary *)body error:(NSError *)error metadata:(

};

FBSDKSystemAccountStoreAdapter *adapter = [FBSDKSystemAccountStoreAdapter sharedInstance];
NSString *metadataTokenString = metadata.request.tokenString;
NSString *currentTokenString = [FBSDKAccessToken currentAccessToken].tokenString;
NSString *accountStoreTokenString = adapter.accessTokenString;
BOOL isAccountStoreLogin = [metadataTokenString isEqualToString:accountStoreTokenString];

if ([metadataTokenString isEqualToString:currentTokenString] || isAccountStoreLogin) {
if ([metadataTokenString isEqualToString:currentTokenString]) {
NSInteger errorCode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorCodeKey] integerValue];
NSInteger errorSubcode = [error.userInfo[FBSDKGraphRequestErrorGraphErrorSubcodeKey] integerValue];
if (errorCode == 190 || errorCode == 102) {
if (isAccountStoreLogin) {
if (errorSubcode == 460) {
// For iOS6, when the password is changed on the server, the system account store
// will continue to issue the old token until the user has changed the
// password AND _THEN_ a renew call is made. To prevent opening
// with an old token which would immediately be closed, we tell our adapter
// that we want to force a blocking renew until success.
adapter.forceBlockingRenew = YES;
} else {
[adapter renewSystemAuthorization:^(ACAccountCredentialRenewResult result, NSError *renewError) {
NSOperationQueue *queue = self->_delegateQueue ?: [NSOperationQueue mainQueue];
[queue addOperationWithBlock:^{
clearToken(errorSubcode);
finishAndInvokeCompletionHandler();
}];
}];
return;
}
}
clearToken(errorSubcode);
} else if (errorCode >= 200 && errorCode < 300) {
// permission error
[adapter renewSystemAuthorization:^(ACAccountCredentialRenewResult result, NSError *renewError) {
NSOperationQueue *queue = self->_delegateQueue ?: [NSOperationQueue mainQueue];
[queue addOperationWithBlock:finishAndInvokeCompletionHandler];
}];
return;
}
}
#endif
Expand Down
1 change: 0 additions & 1 deletion FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#import "FBSDKContainerViewController.h"
#import "BridgeAPI/FBSDKBridgeAPI.h"
#import "FBSDKMonotonicTime.h"
#import "FBSDKSystemAccountStoreAdapter.h"
#import "FBSDKTriStateBOOL.h"
#import "UI/FBSDKCloseIcon.h"
#import "UI/FBSDKColor.h"
Expand Down

This file was deleted.

Loading

0 comments on commit 40edfef

Please sign in to comment.