public class GenericOAuth1ServiceProvider extends AbstractOAuth1ServiceProvider<RestOperations>
OAuth1ServiceProvider
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 service provider is simply a RestOperations
, but the underlying RestTemplate
is configured to automatically
add Authorization
headers to all requests.Constructor and Description |
---|
GenericOAuth1ServiceProvider(String consumerKey,
String consumerSecret,
String requestTokenUrl,
String authorizeUrl,
String authenticateUrl,
String accessTokenUrl,
OAuth1Version oauth1Version)
Creates an instance of GenericOAuth1ServiceProvider for a provider that offers a separate authentication URL.
|
Modifier and Type | Method and Description |
---|---|
RestOperations |
getApi(String accessToken,
String secret)
Returns an API interface allowing the client application to access protected resources on behalf of a user.
|
getConsumerKey, getConsumerSecret, getOAuthOperations
public GenericOAuth1ServiceProvider(String consumerKey, String consumerSecret, String requestTokenUrl, String authorizeUrl, String authenticateUrl, String accessTokenUrl, OAuth1Version oauth1Version)
consumerKey
- The application's consumer key for the API.consumerSecret
- The application's consumer secret for the API.requestTokenUrl
- The API's OAuth 1.0/1.0a request token URL.authorizeUrl
- The API's OAuth 1.0/1.0a authorization URL.authenticateUrl
- The API's OAuth 1.0/1.0a authentication URL. If null, then the authorization URL will be used by default.accessTokenUrl
- The API's OAuth 1.0/1.0a access token URL.oauth1Version
- The version of OAuth 1 (OAuth 1.0 or OAuth 1.0a) supported by the provider.public RestOperations getApi(String accessToken, String secret)
OAuth1ServiceProvider
getApi
in interface OAuth1ServiceProvider<RestOperations>
getApi
in class AbstractOAuth1ServiceProvider<RestOperations>
accessToken
- the API access tokensecret
- the access token secret