com.google.api.client.googleapis.auth.oauth2.draft10
Class GoogleAccessProtectedResource
java.lang.Object
com.google.api.client.auth.oauth2.draft10.AccessProtectedResource
com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource
- All Implemented Interfaces:
- HttpExecuteInterceptor, HttpRequestInitializer, HttpUnsuccessfulResponseHandler
Deprecated. (scheduled to be removed in 1.9) Use
GoogleCredential
@Deprecated
public class GoogleAccessProtectedResource
- extends AccessProtectedResource
Thread-safe Google extension to the OAuth 2.0 (draft 10) method for specifying and refreshing the
access token parameter as a request parameter.
Sample usage, taking advantage that this class implements HttpRequestInitializer
:
public static HttpRequestFactory createRequestFactoryNoRefresh(HttpTransport transport,
JsonFactory jsonFactory, AccessTokenResponse accessTokenResponse) {
return transport.createRequestFactory(new GoogleAccessProtectedResource(
accessTokenResponse.accessToken));
}
public static HttpRequestFactory createRequestFactory(HttpTransport transport,
JsonFactory jsonFactory, AccessTokenResponse accessTokenResponse) {
return transport.createRequestFactory(new GoogleAccessProtectedResource(
accessTokenResponse.accessToken, transport, jsonFactory, "s6BhdRkqt3", "gX1fBat3bV",
accessTokenResponse.refreshToken));
}
If you need to persist the access token in a data store, subclass AccessProtectedResource and
override AccessProtectedResource.onAccessToken(String)
.
If you have a custom request initializer, request execute interceptor, or unsuccessful response
handler, take a look at the sample usage for HttpExecuteInterceptor
and
HttpUnsuccessfulResponseHandler
, which are interfaces that this class also implements.
- Since:
- 1.4
- Author:
- Yaniv Inbar
Methods inherited from class com.google.api.client.auth.oauth2.draft10.AccessProtectedResource |
executeAccessTokenRequest, getAccessToken, getAuthorizationServerUrl, getClientId, getClientSecret, getJsonFactory, getMethod, getRefreshToken, getTransport, handleResponse, initialize, intercept, onAccessToken, refreshToken, setAccessToken |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GoogleAccessProtectedResource
public GoogleAccessProtectedResource(String accessToken)
- Deprecated.
- Parameters:
accessToken
- access token or null
for none
GoogleAccessProtectedResource
public GoogleAccessProtectedResource(String accessToken,
HttpTransport transport,
JsonFactory jsonFactory,
String clientId,
String clientSecret,
String refreshToken)
- Deprecated.
- Parameters:
accessToken
- access token or null
for nonetransport
- HTTP transport for executing refresh token requestjsonFactory
- JSON factory to use for parsing response for refresh token requestclientId
- client identifierclientSecret
- client secretrefreshToken
- refresh token associated with the access token to be refreshed or
null
for none
executeRefreshToken
protected boolean executeRefreshToken()
throws IOException
- Deprecated.
- Overrides:
executeRefreshToken
in class AccessProtectedResource
- Throws:
IOException
Copyright © 2010-2012 Google. All Rights Reserved.