Class OAuthHmacCredential
- java.lang.Object
-
- com.google.api.client.extensions.auth.helpers.oauth.OAuthHmacCredential
-
- All Implemented Interfaces:
Credential,com.google.api.client.http.HttpExecuteInterceptor,com.google.api.client.http.HttpRequestInitializer,com.google.api.client.http.HttpUnsuccessfulResponseHandler,javax.jdo.InstanceCallbacks,javax.jdo.listener.ClearCallback,javax.jdo.listener.DeleteCallback,javax.jdo.listener.LoadCallback,javax.jdo.listener.StoreCallback
@Beta public final class OAuthHmacCredential extends java.lang.Object implements Credential, javax.jdo.InstanceCallbacks
Beta
OAuth 1 credential which uses theOAuthHmacSignerto sign requests. This class is both immutable and thread safe.- Since:
- 1.5
-
-
Field Summary
Fields Modifier and Type Field Description private OAuthParametersauthorizerAuthorizer instance used to sign requests.private java.lang.StringconsumerKeyKey that identifies the server to the service provider.private java.lang.StringsharedSecretSecret that the server shares with the service provider.private java.lang.StringtokenToken that has been authorized by the end user to allow the server to access the resources ornullfor none.private java.lang.StringtokenSharedSecretToken secret that server uses to authenticate the requests.private java.lang.StringuserIdPrimary key that will be used to store and retrieve this credential.
-
Constructor Summary
Constructors Constructor Description OAuthHmacCredential(java.lang.String userId, java.lang.String consumerKey, java.lang.String sharedSecret, java.lang.String tokenSharedSecret, java.lang.String token)Create an OAuth 1 credential object from information obtained from the server.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhandleResponse(com.google.api.client.http.HttpRequest request, com.google.api.client.http.HttpResponse response, boolean retrySupported)voidinitialize(com.google.api.client.http.HttpRequest request)voidintercept(com.google.api.client.http.HttpRequest request)booleanisInvalid()Determine if the Credential is no longer valid, after being revoked for example.voidjdoPostLoad()voidjdoPreClear()voidjdoPreDelete()voidjdoPreStore()private voidpostConstruct()
-
-
-
Field Detail
-
userId
private java.lang.String userId
Primary key that will be used to store and retrieve this credential. Usually the user id of the logged in user.
-
consumerKey
private java.lang.String consumerKey
Key that identifies the server to the service provider.
-
sharedSecret
private java.lang.String sharedSecret
Secret that the server shares with the service provider.
-
tokenSharedSecret
private java.lang.String tokenSharedSecret
Token secret that server uses to authenticate the requests.
-
token
private java.lang.String token
Token that has been authorized by the end user to allow the server to access the resources ornullfor none.
-
authorizer
private OAuthParameters authorizer
Authorizer instance used to sign requests.
-
-
Constructor Detail
-
OAuthHmacCredential
public OAuthHmacCredential(java.lang.String userId, java.lang.String consumerKey, java.lang.String sharedSecret, java.lang.String tokenSharedSecret, java.lang.String token)Create an OAuth 1 credential object from information obtained from the server.- Parameters:
userId- User ID key that can be used to associate this credential with a user.consumerKey- Key that identifies the server to the service provider.sharedSecret- Secret that the server shares with the service provider.tokenSharedSecret- Token secret that server uses to authenticate the requests.token- Token that has been authorized by the end user to allow the server to access the resources ornullfor none
-
-
Method Detail
-
postConstruct
private void postConstruct()
-
initialize
public void initialize(com.google.api.client.http.HttpRequest request) throws java.io.IOException- Specified by:
initializein interfacecom.google.api.client.http.HttpRequestInitializer- Throws:
java.io.IOException
-
intercept
public void intercept(com.google.api.client.http.HttpRequest request) throws java.io.IOException- Specified by:
interceptin interfacecom.google.api.client.http.HttpExecuteInterceptor- Throws:
java.io.IOException
-
handleResponse
public boolean handleResponse(com.google.api.client.http.HttpRequest request, com.google.api.client.http.HttpResponse response, boolean retrySupported)- Specified by:
handleResponsein interfacecom.google.api.client.http.HttpUnsuccessfulResponseHandler
-
jdoPreClear
public void jdoPreClear()
- Specified by:
jdoPreClearin interfacejavax.jdo.listener.ClearCallback
-
jdoPreDelete
public void jdoPreDelete()
- Specified by:
jdoPreDeletein interfacejavax.jdo.listener.DeleteCallback
-
jdoPostLoad
public void jdoPostLoad()
- Specified by:
jdoPostLoadin interfacejavax.jdo.listener.LoadCallback
-
jdoPreStore
public void jdoPreStore()
- Specified by:
jdoPreStorein interfacejavax.jdo.listener.StoreCallback
-
isInvalid
public boolean isInvalid()
Description copied from interface:CredentialDetermine if the Credential is no longer valid, after being revoked for example.- Specified by:
isInvalidin interfaceCredential
-
-