Class CredentialStoreRefreshListener
- java.lang.Object
-
- com.google.api.client.auth.oauth2.CredentialStoreRefreshListener
-
- All Implemented Interfaces:
CredentialRefreshListener
@Deprecated @Beta public final class CredentialStoreRefreshListener extends java.lang.Object implements CredentialRefreshListener
Deprecated.(to be removed in the future) UseDataStoreCredentialRefreshListener
instead.Beta
Thread-safe OAuth 2.0 credential refresh listener that stores the refresh token response in the credential store.It needs to be added as a refresh listener using
Credential.Builder.addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener)
.- Since:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private CredentialStore
credentialStore
Deprecated.Credential store.private java.lang.String
userId
Deprecated.User ID whose credential is to be updated.
-
Constructor Summary
Constructors Constructor Description CredentialStoreRefreshListener(java.lang.String userId, CredentialStore credentialStore)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CredentialStore
getCredentialStore()
Deprecated.Returns the credential store.void
makePersistent(Credential credential)
Deprecated.Stores the updated credential in the credential store.void
onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse)
Deprecated.Notifies of an error token response fromCredential.refreshToken()
.void
onTokenResponse(Credential credential, TokenResponse tokenResponse)
Deprecated.Notifies of a successful token response fromCredential.refreshToken()
.
-
-
-
Field Detail
-
credentialStore
private final CredentialStore credentialStore
Deprecated.Credential store.
-
userId
private final java.lang.String userId
Deprecated.User ID whose credential is to be updated.
-
-
Constructor Detail
-
CredentialStoreRefreshListener
public CredentialStoreRefreshListener(java.lang.String userId, CredentialStore credentialStore)
Deprecated.- Parameters:
userId
- user ID whose credential is to be updatedcredentialStore
- credential store
-
-
Method Detail
-
onTokenResponse
public void onTokenResponse(Credential credential, TokenResponse tokenResponse) throws java.io.IOException
Deprecated.Description copied from interface:CredentialRefreshListener
Notifies of a successful token response fromCredential.refreshToken()
.Typical use is to provide functionality like persisting the access token in a data store. Implementations can assume proper thread synchronization is already taken care of inside
Credential.refreshToken()
. Implementations can also assume thatCredential.setAccessToken(java.lang.String)
,Credential.setRefreshToken(java.lang.String)
, andCredential.setExpiresInSeconds(java.lang.Long)
have already been called previously with the information from theTokenResponse
.- Specified by:
onTokenResponse
in interfaceCredentialRefreshListener
- Parameters:
credential
- credential on which the token refresh appliedtokenResponse
- token response- Throws:
java.io.IOException
-
onTokenErrorResponse
public void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) throws java.io.IOException
Deprecated.Description copied from interface:CredentialRefreshListener
Notifies of an error token response fromCredential.refreshToken()
.Typical use is to provide functionality like removing persistence of the access token from the data store. Implementations can assume proper thread synchronization is already taken care of inside
Credential.refreshToken()
. Implementations can also assume thatCredential.setAccessToken(java.lang.String)
, andCredential.setExpiresInSeconds(java.lang.Long)
have already been called previously withnull
to clear their values.- Specified by:
onTokenErrorResponse
in interfaceCredentialRefreshListener
- Parameters:
credential
- credential on which the token refresh appliedtokenErrorResponse
- token error response ornull
for none supplied- Throws:
java.io.IOException
-
getCredentialStore
public CredentialStore getCredentialStore()
Deprecated.Returns the credential store.
-
makePersistent
public void makePersistent(Credential credential) throws java.io.IOException
Deprecated.Stores the updated credential in the credential store.- Throws:
java.io.IOException
-
-