Spring Social

org.springframework.social.connect.support
Class OAuth1ConnectionFactory<A>

java.lang.Object
  extended by org.springframework.social.connect.ConnectionFactory<A>
      extended by org.springframework.social.connect.support.OAuth1ConnectionFactory<A>
Type Parameters:
A - the service provider's API type.

public class OAuth1ConnectionFactory<A>
extends ConnectionFactory<A>

Factory for creating OAuth1-based Connections. May be subclassed to further simplify construction e.g. TwitterConnectionFactory.

Author:
Keith Donald

Constructor Summary
OAuth1ConnectionFactory(java.lang.String providerId, OAuth1ServiceProvider<A> serviceProvider, ApiAdapter<A> apiAdapter)
          Create a OAuth1ConnectionFactory.
 
Method Summary
 Connection<A> createConnection(ConnectionData data)
          Create a OAuth1-based Connection from the connection data.
 Connection<A> createConnection(OAuthToken accessToken)
          Create a OAuth1-based Connection from the access token response returned after completing the OAuth1 flow.
protected  java.lang.String extractProviderUserId(OAuthToken accessToken)
          Hook for extracting the providerUserId from the returned access token response, if it is available.
 OAuth1Operations getOAuthOperations()
          Get the ServiceProvider's OAuth1Operations that allows the client application to conduct the OAuth1 flow with the provider.
 
Methods inherited from class org.springframework.social.connect.ConnectionFactory
getApiAdapter, getProviderId, getServiceProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAuth1ConnectionFactory

public OAuth1ConnectionFactory(java.lang.String providerId,
                               OAuth1ServiceProvider<A> serviceProvider,
                               ApiAdapter<A> apiAdapter)
Create a OAuth1ConnectionFactory.

Parameters:
providerId - the provider id e.g. "twitter"
serviceProvider - the ServiceProvider model for conducting the authorization flow and obtaining a native service API instance.
apiAdapter - the ApiAdapter for mapping the provider-specific service API model to the uniform Connection interface.
Method Detail

getOAuthOperations

public OAuth1Operations getOAuthOperations()
Get the ServiceProvider's OAuth1Operations that allows the client application to conduct the OAuth1 flow with the provider.


createConnection

public Connection<A> createConnection(OAuthToken accessToken)
Create a OAuth1-based Connection from the access token response returned after completing the OAuth1 flow.

Parameters:
accessToken - the access token
Returns:
the new service provider connection
See Also:
OAuth1Operations.exchangeForAccessToken(org.springframework.social.oauth1.AuthorizedRequestToken, org.springframework.util.MultiValueMap)

createConnection

public Connection<A> createConnection(ConnectionData data)
Create a OAuth1-based Connection from the connection data.

Specified by:
createConnection in class ConnectionFactory<A>

extractProviderUserId

protected java.lang.String extractProviderUserId(OAuthToken accessToken)
Hook for extracting the providerUserId from the returned access token response, if it is available. Default implementation returns null, indicating it is not exposed and another remote API call will be required to obtain it. Subclasses may override.


Spring Social