|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.client.extensions.auth.helpers.oauth2.draft10.OAuth2Credential
Credential
@Deprecated public final class OAuth2Credential
Credential implementation that is used to authorize OAuth2 enabled requests through the
use of the access_token header, as well as refresh the token when it is required. It is important
that access to this class be made from within a managed JDO context and that the persistence
manager be closed in a finally block to save any updates to the access token.
This class is safe to use from multiple threads.
| Constructor Summary | |
|---|---|
OAuth2Credential(String userId,
String accessToken)
Deprecated. Create an instance of an OAuth2Credential that can be used to authorize requests on behalf of an end user. |
|
OAuth2Credential(String userId,
String accessToken,
String refreshToken)
Deprecated. Create an instance of an OAuth2Credential that can be used to authorize requests on behalf of an end user. |
|
| Method Summary | |
|---|---|
String |
getAccessToken()
Deprecated. Return the current access token. |
String |
getRefreshToken()
Deprecated. Return the refresh token with which this object was constructed or null for none. |
boolean |
handleResponse(HttpRequest request,
HttpResponse response,
boolean retrySupported)
Deprecated. |
void |
initialize(HttpRequest request)
Deprecated. |
void |
initializeForRefresh(String clientId,
String clientSecret,
String refreshUrl,
JsonFactory jsonFactory,
HttpTransport transport)
Deprecated. Initialize the instance with the required information to allow token refresh. |
void |
intercept(HttpRequest request)
Deprecated. |
boolean |
isInvalid()
Deprecated. Determine if the Credential is no longer valid, after being revoked for example. |
void |
jdoPostLoad()
Deprecated. |
void |
jdoPreClear()
Deprecated. |
void |
jdoPreDelete()
Deprecated. |
void |
jdoPreStore()
Deprecated. |
boolean |
refresh(HttpTransport transport,
JsonFactory factory)
Deprecated. Force a refresh of this credential if possible using the HttpTransport and
JsonFactory objects provided for the network communication. |
void |
setAccessToken(String accessToken)
Deprecated. Sets the access token or null for none. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OAuth2Credential(String userId,
String accessToken,
String refreshToken)
initializeForRefresh(String, String, String, JsonFactory, HttpTransport) to provide
the necessary information to allow token refresh.
userId - Key that can be used to associate this Credential object with an end user.accessToken - Access token that can be used to authorize this request.refreshToken - Token that can be given to the token server in exchange for a new access
token or null for none.
public OAuth2Credential(String userId,
String accessToken)
userId - Key that can be used to associate this Credential object with an end user.accessToken - Access token that can be used to authorize this request.| Method Detail |
|---|
public boolean refresh(HttpTransport transport,
JsonFactory factory)
throws IOException
HttpTransport and
JsonFactory objects provided for the network communication.
transport - HttpTransport to use for the refreshfactory - JsonFactory to use to parse the auth response
IOException - When the credential can not communicate with the token server.
public void initialize(HttpRequest request)
throws IOException
initialize in interface HttpRequestInitializerIOException
public void intercept(HttpRequest request)
throws IOException
intercept in interface HttpExecuteInterceptorIOException
public boolean handleResponse(HttpRequest request,
HttpResponse response,
boolean retrySupported)
handleResponse in interface HttpUnsuccessfulResponseHandler
public void initializeForRefresh(String clientId,
String clientSecret,
String refreshUrl,
JsonFactory jsonFactory,
HttpTransport transport)
clientId - Used to identify the client server with the token server.clientSecret - Secret shared between the client server and the token server.refreshUrl - Url which can be used to exchange the refresh token for a new access token.jsonFactory - Json factory used to deserialize communications with the token server.transport - Transport used to send requests to the token server.public String getAccessToken()
public void setAccessToken(String accessToken)
null for none.
public String getRefreshToken()
null for none. This
can be used for out of band use cases, but most users should just let the credential be
refreshed by the library when a call fails.
public void jdoPreClear()
jdoPreClear in interface javax.jdo.listener.ClearCallbackpublic void jdoPreDelete()
jdoPreDelete in interface javax.jdo.listener.DeleteCallbackpublic void jdoPostLoad()
jdoPostLoad in interface javax.jdo.listener.LoadCallbackpublic void jdoPreStore()
jdoPreStore in interface javax.jdo.listener.StoreCallbackpublic boolean isInvalid()
Credential
isInvalid in interface Credential
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||