|
Spring Social | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.social.connect.ConnectionFactory<S> org.springframework.social.connect.support.OAuth2ConnectionFactory<S>
S
- the service API type.public class OAuth2ConnectionFactory<S>
Factory for creating OAuth2-based Connection
s.
May be subclassed to further simplify construction e.g. FacebookConnectionFactory.
Constructor Summary | |
---|---|
OAuth2ConnectionFactory(java.lang.String providerId,
OAuth2ServiceProvider<S> serviceProvider,
ApiAdapter<S> apiAdapter)
Create a OAuth2ConnectionFactory . |
Method Summary | |
---|---|
Connection<S> |
createConnection(AccessGrant accessGrant)
Create a OAuth2-based Connection from the AccessGrant returned after completing the OAuth2 flow . |
Connection<S> |
createConnection(ConnectionData data)
Create a OAuth2-based Connection from the connection data. |
protected java.lang.String |
extractProviderUserId(AccessGrant accessGrant)
Hook for extracting the providerUserId from the returned AccessGrant , if it is available. |
java.lang.String |
generateState()
Generates a value for the state parameter. |
OAuth2Operations |
getOAuthOperations()
Get the ServiceProvider's OAuth2Operations that allows the client application to conduct the OAuth2 flow with the provider. |
java.lang.String |
getScope()
|
void |
setScope(java.lang.String scope)
Sets the default value to send in the scope parameter during authorization. |
boolean |
supportsStateParameter()
Indicates that this provider supports the state parameter in callbacks to prevent against CSRF. |
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 |
---|
public OAuth2ConnectionFactory(java.lang.String providerId, OAuth2ServiceProvider<S> serviceProvider, ApiAdapter<S> apiAdapter)
OAuth2ConnectionFactory
.
providerId
- the provider id e.g. "facebook"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 |
---|
public void setScope(java.lang.String scope)
scope
- The default value to send as scope during authorization.public java.lang.String getScope()
public java.lang.String generateState()
public boolean supportsStateParameter()
public OAuth2Operations getOAuthOperations()
OAuth2Operations
that allows the client application to conduct the OAuth2 flow with the provider.
public Connection<S> createConnection(AccessGrant accessGrant)
Connection
from the AccessGrant
returned after completing the OAuth2 flow
.
accessGrant
- the access grant
OAuth2Operations.exchangeForAccess(String, String, org.springframework.util.MultiValueMap)
public Connection<S> createConnection(ConnectionData data)
Connection
from the connection data.
createConnection
in class ConnectionFactory<S>
protected java.lang.String extractProviderUserId(AccessGrant accessGrant)
AccessGrant
, 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 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |