public class GenericOAuth2ServiceProvider extends AbstractOAuth2ServiceProvider<RestOperations>
OAuth2ServiceProviderthat 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 service provider is simply a
RestOperations, but the underlying
RestTemplateis configured to automatically add
Authorizationheaders to all requests.
|Constructor and Description|
Creates an instance of GenericOAuth1ServiceProvider for a provider that offers a separate authentication URL.
|Modifier and Type||Method and Description|
Returns an API interface allowing the client application to access protected resources on behalf of a user.
public GenericOAuth2ServiceProvider(String appId, String appSecret, String authorizeUrl, String authenticateUrl, String accessTokenUrl, boolean useParametersForClientCredentials, TokenStrategy tokenStrategy)
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. If null, then the authorization URL will be used by default.
accessTokenUrl- The API's OAuth 2 access token URL.
useParametersForClientCredentials- If true, client credentials will be sent as parameters. If false, the client with be authenticated via HTTP Basic
tokenStrategy- The token strategy indicating how the access token should be carried on API requests.
public RestOperations getApi(String accessToken)