Преглед изворни кода

Assign to keychainStore asap in initializer (#540)

mdmathias пре 7 месеци
родитељ
комит
f478a1de2f
1 измењених фајлова са 2 додато и 6 уклоњено
  1. 2 6
      GoogleSignIn/Sources/GIDSignIn.m

+ 2 - 6
GoogleSignIn/Sources/GIDSignIn.m

@@ -541,6 +541,8 @@ static NSString *const kConfigOpenIDRealmKey = @"GIDOpenIDRealm";
             authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService {
   self = [super init];
   if (self) {
+    _keychainStore = keychainStore;
+
     // Get the bundle of the current executable.
     NSBundle *bundle = NSBundle.mainBundle;
 
@@ -552,11 +554,6 @@ static NSString *const kConfigOpenIDRealmKey = @"GIDOpenIDRealm";
     // Check to see if the 3P app is being run for the first time after a fresh install.
     BOOL isFreshInstall = [self isFreshInstall];
 
-    // If this is a fresh install, ensure that any pre-existing keychain data is purged.
-    if (isFreshInstall) {
-      [self removeAllKeychainEntries];
-    }
-
     NSString *authorizationEnpointURL = [NSString stringWithFormat:kAuthorizationURLTemplate,
                                          [GIDSignInPreferences googleAuthorizationServer]];
     NSString *tokenEndpointURL = [NSString stringWithFormat:kTokenURLTemplate,
@@ -564,7 +561,6 @@ static NSString *const kConfigOpenIDRealmKey = @"GIDOpenIDRealm";
     _appAuthConfiguration = [[OIDServiceConfiguration alloc]
                              initWithAuthorizationEndpoint:[NSURL URLWithString:authorizationEnpointURL]
                              tokenEndpoint:[NSURL URLWithString:tokenEndpointURL]];
-    _keychainStore = keychainStore;
     // Perform migration of auth state from old versions of the SDK if needed.
     [authStateMigrationService migrateIfNeededWithTokenURL:_appAuthConfiguration.tokenEndpoint
                                               callbackPath:kBrowserCallbackPath