org.springframework.social.oauth1
Interface OAuth1Operations

All Known Implementing Classes:
OAuth1Template

public interface OAuth1Operations

A service interface for the OAuth 1 flow. This interface allows you to conduct the "OAuth dance" with a service provider on behalf of a user.


Method Summary
 java.lang.String buildAuthenticateUrl(java.lang.String requestToken, OAuth1Parameters parameters)
          Construct the URL to redirect the user to for authentication.
 java.lang.String buildAuthorizeUrl(java.lang.String requestToken, OAuth1Parameters parameters)
          Construct the URL to redirect the user to for authorization.
 OAuthToken exchangeForAccessToken(AuthorizedRequestToken requestToken, MultiValueMap<java.lang.String,java.lang.String> additionalParameters)
          Exchange the authorized request token for an access token.
 OAuthToken fetchRequestToken(java.lang.String callbackUrl, MultiValueMap<java.lang.String,java.lang.String> additionalParameters)
          Begin a new authorization flow by fetching a new request token from this service provider.
 OAuth1Version getVersion()
          The version of OAuth1 implemented by this operations instance.
 

Method Detail

getVersion

OAuth1Version getVersion()
The version of OAuth1 implemented by this operations instance.

See Also:
OAuth1Version.CORE_10, OAuth1Version.CORE_10_REVISION_A

fetchRequestToken

OAuthToken fetchRequestToken(java.lang.String callbackUrl,
                             MultiValueMap<java.lang.String,java.lang.String> additionalParameters)
Begin a new authorization flow by fetching a new request token from this service provider. The request token should be stored in the user's session up until the authorization callback is made and it's time to exchange it for an access token.

Parameters:
callbackUrl - the URL the provider should redirect to after the member authorizes the connection. Ignored for OAuth 1.0 providers.
additionalParameters - any additional query parameters to be sent when fetching the request token. Should not be encoded.
Returns:
a temporary request token use for authorization and exchanged for an access token

buildAuthorizeUrl

java.lang.String buildAuthorizeUrl(java.lang.String requestToken,
                                   OAuth1Parameters parameters)
Construct the URL to redirect the user to for authorization.

Parameters:
requestToken - the request token value, to be encoded in the authorize URL.
parameters - parameters to pass to the provider in the authorize URL. Should never be null; if there are no parameters to pass, set this argument value to OAuth1Parameters.NONE.
Returns:
the absolute authorize URL to redirect the user to for authorization

buildAuthenticateUrl

java.lang.String buildAuthenticateUrl(java.lang.String requestToken,
                                      OAuth1Parameters parameters)
Construct the URL to redirect the user to for authentication. For some provider, the authenticate URL differs from the authorizationUrl slightly in that it does not require the user to authorize the app multiple times. This provides a better user experience for "Sign in with Provider" scenarios.

Parameters:
requestToken - the request token value, to be encoded in the authorize URL.
parameters - parameters to pass to the provider in the authenticate URL. Should never be null; if there are no parameters to pass, set this argument value to OAuth1Parameters.NONE.
Returns:
the absolute authenticate URL to redirect the user to for authentication

exchangeForAccessToken

OAuthToken exchangeForAccessToken(AuthorizedRequestToken requestToken,
                                  MultiValueMap<java.lang.String,java.lang.String> additionalParameters)
Exchange the authorized request token for an access token.

Parameters:
requestToken - an authorized request token and verifier. The verifier will be ignored for OAuth 1.0 providers.
additionalParameters - any additional query parameters to be sent when fetching the access token. Should not be encoded.
Returns:
an access token granted by the provider