|
||||||||||
| 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)
throws IOException
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.
Upgrade warning: since version 1.10 this method throws an IOException. This was not
done prior to 1.10.
onTokenResponse in interface CredentialRefreshListenercredential - credential on which the token refresh appliedtokenResponse - token response
IOException
public void onTokenErrorResponse(Credential credential,
TokenErrorResponse tokenErrorResponse)
throws IOException
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.
Upgrade warning: since version 1.10 this method throws an IOException. This was not
done prior to 1.10.
onTokenErrorResponse in interface CredentialRefreshListenercredential - credential on which the token refresh appliedtokenErrorResponse - token error response or null for none supplied
IOExceptionpublic CredentialStore getCredentialStore()
public void makePersistent(Credential credential)
throws IOException
Upgrade warning: since version 1.10 this method throws an IOException. This was not
done prior to 1.10.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||