public class GenericOAuth2ConnectionFactory extends OAuth2ConnectionFactory<RestOperations>
OAuth2ConnectionFactory
that carries no intrinsic knowledge of the API it will be creating connections against.
Instead, it must be configured with API provider-specific details.
This enables developers to use Spring Social to create connections against any API for which there isn't a ready-to-use connection support and API binding
without creating one-off connection factory and service provider implementations.
The API binding provided by this connection factory is simply a RestOperations
, but the underlying RestTemplate
is configured to automatically
add Authorization
headers to all requests.Constructor and Description |
---|
GenericOAuth2ConnectionFactory(String providerId,
String appId,
String appSecret,
String authorizeUrl,
String accessTokenUrl,
ApiAdapter<RestOperations> apiAdapter)
Creates an instance of GenericOAuth2ConnectionFactory.
|
GenericOAuth2ConnectionFactory(String providerId,
String appId,
String appSecret,
String authorizeUrl,
String authenticateUrl,
String accessTokenUrl,
boolean sendClientCredentialsAsParameters,
TokenStrategy tokenStrategy,
ApiAdapter<RestOperations> apiAdapter)
Creates an instance of GenericOAuth2ConnectionFactory for a provider that offers a separate authentication URL.
|
createConnection, createConnection, extractProviderUserId, generateState, getOAuthOperations, getScope, setScope, supportsStateParameter
getApiAdapter, getProviderId, getServiceProvider
public GenericOAuth2ConnectionFactory(String providerId, String appId, String appSecret, String authorizeUrl, String accessTokenUrl, ApiAdapter<RestOperations> apiAdapter)
providerId
- Some String that acts as the unique ID for the API provider.appId
- The application's ID/key for the API.appSecret
- The application's secret for the API.authorizeUrl
- The API's OAuth 2 authorization URL. Will also be used as the default authentication URL.accessTokenUrl
- The API's OAuth 2 access token URL.apiAdapter
- A custom implementation of ApiAdapter
used to fetch data when creating the connection.public GenericOAuth2ConnectionFactory(String providerId, String appId, String appSecret, String authorizeUrl, String authenticateUrl, String accessTokenUrl, boolean sendClientCredentialsAsParameters, TokenStrategy tokenStrategy, ApiAdapter<RestOperations> apiAdapter)
providerId
- Some String that acts as the unique ID for the API provider.appId
- The application's ID/key for the API.appSecret
- The application's secret for the API.authorizeUrl
- The API's OAuth 2 authorization URL.authenticateUrl
- The API's OAuth 2 authentication URL.accessTokenUrl
- The API's OAuth2 access token URL.sendClientCredentialsAsParameters
- If true, send client credentials as query parameter. If false, use HTTP Basic.tokenStrategy
- The token strategy indicating how the access token should be carried on API requests.apiAdapter
- A custom implementation of ApiAdapter
used to fetch data when creating the connection.