Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

/// Callback that is called when `migrateIfNeededWithTokenURL` is invoked.
@property (nonatomic, nullable) void (^migrationInvokedCallback)
(NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, NSString * _Nullable keychainName,
BOOL isFreshInstall);
(NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, BOOL isFreshInstall);

@end
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore {

- (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
callbackPath:(NSString *)callbackPath
keychainName:(NSString *)keychainName
isFreshInstall:(BOOL)isFreshInstall {
if (_migrationInvokedCallback) {
_migrationInvokedCallback(tokenURL, callbackPath, keychainName, isFreshInstall);
_migrationInvokedCallback(tokenURL, callbackPath, isFreshInstall);
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
/// Perform necessary migrations from legacy auth state storage to most recent GTMAppAuth version.
- (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
callbackPath:(NSString *)callbackPath
keychainName:(NSString *)keychainName
isFreshInstall:(BOOL)isFreshInstall;

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ - (instancetype)init {

- (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
callbackPath:(NSString *)callbackPath
keychainName:(NSString *)keychainName
isFreshInstall:(BOOL)isFreshInstall {
// If this is a fresh install, take no action and mark the migration checks as having been
// performed.
Expand All @@ -82,8 +81,7 @@ - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
[self performDataProtectedMigrationIfNeeded];
#elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
[self performGIDMigrationIfNeededWithTokenURL:tokenURL
callbackPath:callbackPath
keychainName:keychainName];
callbackPath:callbackPath];
#endif // TARGET_OS_OSX
}

Expand Down Expand Up @@ -117,8 +115,7 @@ - (void)performDataProtectedMigrationIfNeeded {
// Migrate from GPPSignIn 1.x or GIDSignIn 1.0 - 4.x to the GTMAppAuth storage introduced in
// GIDSignIn 5.0.
- (void)performGIDMigrationIfNeededWithTokenURL:(NSURL *)tokenURL
callbackPath:(NSString *)callbackPath
keychainName:(NSString *)keychainName {
callbackPath:(NSString *)callbackPath {
// See if we've performed the migration check previously.
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
if ([defaults boolForKey:kGTMAppAuthMigrationCheckPerformedKey]) {
Expand Down
1 change: 0 additions & 1 deletion GoogleSignIn/Sources/GIDSignIn.m
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
// Perform migration of auth state from old versions of the SDK if needed.
[authStateMigrationService migrateIfNeededWithTokenURL:_appAuthConfiguration.tokenEndpoint
callbackPath:kBrowserCallbackPath
keychainName:kGTMAppAuthKeychainName
isFreshInstall:isFreshInstall];
}
return self;
Expand Down
6 changes: 0 additions & 6 deletions GoogleSignIn/Tests/Unit/GIDAuthStateMigrationTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ - (void)testMigrateIfNeeded_NoPreviousMigration_DataProtectedMigration {
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
callbackPath:kCallbackPath
keychainName:kKeychainName
isFreshInstall:NO];

// verify that the auth session was removed during migration
Expand All @@ -179,7 +178,6 @@ - (void)testMigrateIfNeeded_KeychainFailure_DataProtectedMigration {
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
callbackPath:kCallbackPath
keychainName:kKeychainName
isFreshInstall:NO];
XCTAssertNil([_realLegacyGTMKeychainStore retrieveAuthSessionWithError:nil]);
}
Expand All @@ -198,7 +196,6 @@ - (void)testMigrateIfNeeded_NoPreviousMigration_GTMAppAuthMigration {
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
callbackPath:kCallbackPath
keychainName:kKeychainName
isFreshInstall:NO];
}

Expand All @@ -215,7 +212,6 @@ - (void)testMigrateIfNeeded_KeychainFailure_GTMAppAuthMigration {
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
callbackPath:kCallbackPath
keychainName:kKeychainName
isFreshInstall:NO];
}

Expand Down Expand Up @@ -258,7 +254,6 @@ - (void)testMigrateIfNeeded_HasPreviousMigration {
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
callbackPath:kCallbackPath
keychainName:kKeychainName
isFreshInstall:NO];
}

Expand All @@ -274,7 +269,6 @@ - (void)testMigrateIfNeeded_isFreshInstall {
[[GIDAuthStateMigration alloc] initWithKeychainStore:_mockGTMKeychainStore];
[migration migrateIfNeededWithTokenURL:[NSURL URLWithString:kTokenURL]
callbackPath:kCallbackPath
keychainName:kKeychainName
isFreshInstall:YES];
}

Expand Down
6 changes: 2 additions & 4 deletions GoogleSignIn/Tests/Unit/GIDSignInTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -498,16 +498,14 @@ - (void)testInitWithKeychainStore_invalidConfig {
}

- (void)testInitWithKeychainStore_attemptsMigration {
NSString *expectedKeychainName = @"foo";

XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called."];
_authStateMigrationService.migrationInvokedCallback =
^(NSURL *tokenURL, NSString *callbackPath, NSString *keychainName, BOOL isFreshInstall) {
^(NSURL *tokenURL, NSString *callbackPath, BOOL isFreshInstall) {
XCTAssertFalse(isFreshInstall);
[expectation fulfill];
};

GTMKeychainStore *store = [[GTMKeychainStore alloc] initWithItemName:expectedKeychainName];
GTMKeychainStore *store = [[GTMKeychainStore alloc] initWithItemName:kKeychainName];
GIDSignIn *signIn = [[GIDSignIn alloc] initWithKeychainStore:store
authStateMigrationService:_authStateMigrationService];

Expand Down