Class OAuthHmacThreeLeggedFlow
java.lang.Object
com.google.api.client.extensions.auth.helpers.oauth.OAuthHmacThreeLeggedFlow
- All Implemented Interfaces:
ThreeLeggedFlow
Beta
ThreeLeggedFlow
implementation that will execute the proper requests to obtain an OAuth1
Credential object that can be used to sign requests.
This class is not thread safe, nor should you attempt to execute a flow from multiple threads simultaneously.
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
Authorization url which we will use to talk to the server.private final String
Url which is generated to authorize this specific user for this service.private String
Key that identifies the server to the service provider.private String
Secret that is shared between the server and the service provider.private String
Temporary token that gets associated with this flow.private String
Temporary secret that gets associated with the temporary token.private com.google.api.client.http.HttpTransport
Http transport to use to communicate with the auth server.private String
Key that can be used to associate this flow with an end user. -
Constructor Summary
ConstructorsConstructorDescriptionOAuthHmacThreeLeggedFlow
(String userId, String consumerKey, String consumerSecret, String authorizationServerUrl, String temporaryTokenUrl, String callbackUrl, com.google.api.client.http.HttpTransport transport) Create an OAuthThreeLeggedFlow instance from the required information. -
Method Summary
Modifier and TypeMethodDescriptionAfter the user has authorized the request, the token or code obtained should be passed to this complete function to allow us to exchange the code with the authentication server for aCredential
.After the object is created, the developer should use this method to interrogate it for the authorization URL to which the user should be redirected to obtain permission.loadCredential
(javax.jdo.PersistenceManager pm) Convenience function that will load a credential based on the userId for which this flow was instantiated.void
setHttpTransport
(com.google.api.client.http.HttpTransport transport) SetHttpTransport
instance for this three legged flow.void
setJsonFactory
(com.google.api.client.json.JsonFactory jsonFactory) SetJsonFactory
instance for this three legged flow.
-
Field Details
-
userId
Key that can be used to associate this flow with an end user. -
tempToken
Temporary token that gets associated with this flow. -
tempTokenSecret
Temporary secret that gets associated with the temporary token. -
consumerSecret
Secret that is shared between the server and the service provider. -
consumerKey
Key that identifies the server to the service provider. -
authorizationServerUrl
Authorization url which we will use to talk to the server. -
authorizationUrl
Url which is generated to authorize this specific user for this service. -
transport
private com.google.api.client.http.HttpTransport transportHttp transport to use to communicate with the auth server.
-
-
Constructor Details
-
OAuthHmacThreeLeggedFlow
public OAuthHmacThreeLeggedFlow(String userId, String consumerKey, String consumerSecret, String authorizationServerUrl, String temporaryTokenUrl, String callbackUrl, com.google.api.client.http.HttpTransport transport) throws IOException Create an OAuthThreeLeggedFlow instance from the required information.- Parameters:
userId
- Key that can be used to associate this flow with an end user.consumerKey
- Key that identifies the server to the service provider.consumerSecret
- Secret that is shared between the server and the service provider.authorizationServerUrl
- Url with which we communicate to authorize tis application.temporaryTokenUrl
- Url which we will use to obtain a temporary token.callbackUrl
- Url which the server should redirect the user to after obtaining authorization.- Throws:
IOException
- Exception thrown when the flow is unable to communicate with the service provider.
-
-
Method Details
-
getAuthorizationUrl
Description copied from interface:ThreeLeggedFlow
After the object is created, the developer should use this method to interrogate it for the authorization URL to which the user should be redirected to obtain permission.- Specified by:
getAuthorizationUrl
in interfaceThreeLeggedFlow
- Returns:
- URL to which the user should be directed
-
complete
Description copied from interface:ThreeLeggedFlow
After the user has authorized the request, the token or code obtained should be passed to this complete function to allow us to exchange the code with the authentication server for aCredential
.- Specified by:
complete
in interfaceThreeLeggedFlow
- Parameters:
authorizationCode
- Code or token obtained after the user grants permission- Returns:
Credential
object that is obtained from token server- Throws:
IOException
-
loadCredential
Description copied from interface:ThreeLeggedFlow
Convenience function that will load a credential based on the userId for which this flow was instantiated.- Specified by:
loadCredential
in interfaceThreeLeggedFlow
- Parameters:
pm
-PersistenceManager
instance which this flow should use to interact with the data store. The caller must remember to callPersistenceManager.close()
after this method returns.- Returns:
- Fully initialized
Credential
object ornull
if none exists.
-
setHttpTransport
public void setHttpTransport(com.google.api.client.http.HttpTransport transport) Description copied from interface:ThreeLeggedFlow
SetHttpTransport
instance for this three legged flow.- Specified by:
setHttpTransport
in interfaceThreeLeggedFlow
-
setJsonFactory
public void setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory) Description copied from interface:ThreeLeggedFlow
SetJsonFactory
instance for this three legged flow.- Specified by:
setJsonFactory
in interfaceThreeLeggedFlow
-