|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.client.auth.oauth2.CredentialStoreRefreshListener
public final class CredentialStoreRefreshListener
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).
| Constructor Summary | |
|---|---|
CredentialStoreRefreshListener(String userId,
CredentialStore credentialStore)
|
|
| Method Summary | |
|---|---|
CredentialStore |
getCredentialStore()
Returns the credential store. |
void |
makePersistent(Credential credential)
Stores the updated credential in the credential store. |
void |
onTokenErrorResponse(Credential credential,
TokenErrorResponse tokenErrorResponse)
Notifies of an error token response from Credential.refreshToken(). |
void |
onTokenResponse(Credential credential,
TokenResponse tokenResponse)
Notifies of a successful token response from Credential.refreshToken(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CredentialStoreRefreshListener(String userId,
CredentialStore credentialStore)
userId - user ID whose credential is to be updatedcredentialStore - credential store| Method Detail |
|---|
public void onTokenResponse(Credential credential,
TokenResponse tokenResponse)
CredentialRefreshListenerCredential.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 that
Credential.setAccessToken(java.lang.String), Credential.setRefreshToken(java.lang.String), and
Credential.setExpiresInSeconds(java.lang.Long) have already been called previously with the information
from the TokenResponse.
onTokenResponse in interface CredentialRefreshListenercredential - credential on which the token refresh appliedtokenResponse - token response
public void onTokenErrorResponse(Credential credential,
TokenErrorResponse tokenErrorResponse)
CredentialRefreshListenerCredential.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 that
Credential.setAccessToken(java.lang.String), and Credential.setExpiresInSeconds(java.lang.Long) have already been
called previously with null to clear their values.
onTokenErrorResponse in interface CredentialRefreshListenercredential - credential on which the token refresh appliedtokenErrorResponse - token error response or null for none suppliedpublic CredentialStore getCredentialStore()
public void makePersistent(Credential credential)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||