google / GTMAppAuth

Apple platforms SDK for using AppAuth with Google libraries.
Apache License 2.0
379 stars 198 forks source link

Adds protocols to model credential storage #197

Closed mdmathias closed 1 year ago

mdmathias commented 2 years ago

This change also removes saving, reading, and removing operations from the API for GTMAppAuthFetcherAuthorization and GTMOAuth2KeychainCompatibility.

petea commented 2 years ago

The direction here feels good.

Relatedly, here's a straw man (re)naming proposal for discussion:

GTMAppAuthFetcherAuthorization -> GTMAuthState <GTMFetcherAuthorizationProtocol, NSSecureCoding> GTMAuthStateStore GTMKeychainStore <GTMAuthStateStore> GTMOAuth2KeychainCompatibility -> GTMOAuth2CompatibilityStore <GTMAuthStateStore>

// Creates a GTMAuthState from an OIDAuthState.
GTMAuthState *authState = [[GTMAuthState alloc] initWithAuthState:appAuthState];
self.authState = authState;
// Creates a GTMSessionFetcherService with the GTMAuthState as authorizer.
GTMSessionFetcherService *fetcherService = [[GTMSessionFetcherService alloc] init];
fetcherService.authorizer = self.authState;
mdmathias commented 2 years ago

I like the name changes. PR updated.

mdmathias commented 2 years ago

The @objc name for AuthState is currently GTMAppAuthFetcherAuthorization in this change. We should use a different name for ObjC and make sure that the KeychainStore does the right migration.

199