com.sun.jersey.oauth.server.spi
Interface OAuthProvider

All Known Implementing Classes:
DefaultOAuthProvider

public interface OAuthProvider

Contract for a provider that supports managing OAuth tokens and consumer secrets. To add an OAuthProvider implementation, annotate the implementation class with @Provider.

Author:
Martin Matula

Method Summary
 OAuthToken getAccessToken(String token)
          Returns the access token by the consumer key and token value.
 OAuthConsumer getConsumer(String consumerKey)
          Gets consumer corresponding to a given consumer key.
 OAuthToken getRequestToken(String token)
          Returns the request token by the consumer key and token value.
 OAuthToken newAccessToken(OAuthToken requestToken, String verifier)
          Creates a new access token.
 OAuthToken newRequestToken(String consumerKey, String callbackUrl, Map<String,List<String>> attributes)
          Creates a new request token for a given consumerKey.
 

Method Detail

getConsumer

OAuthConsumer getConsumer(String consumerKey)
Gets consumer corresponding to a given consumer key.

Parameters:
consumerKey - consumer key
Returns:
corresponding consumer secret or null if no consumer with the given key is known

newRequestToken

OAuthToken newRequestToken(String consumerKey,
                           String callbackUrl,
                           Map<String,List<String>> attributes)
Creates a new request token for a given consumerKey.

Parameters:
consumerKey - consumer key to create a request token for
callbackUrl - callback url for this request token request
attributes - additional service provider-specific parameters (this can be used to indicate what level of access is requested - i.e. readonly, or r/w, etc.)
Returns:
new request token

getRequestToken

OAuthToken getRequestToken(String token)
Returns the request token by the consumer key and token value.

Parameters:
token - request token value
Returns:
request token or null if no such token corresponding to a given consumer key is found

newAccessToken

OAuthToken newAccessToken(OAuthToken requestToken,
                          String verifier)
Creates a new access token. This method must validate the passed arguments and return null if any of them is invalid.

Parameters:
requestToken - authorized request token
verifier - verifier passed to the callback after authorization
Returns:
new access token or null if the arguments are invalid (e.g. there is no such request token as in the argument, or the verifier does not match)

getAccessToken

OAuthToken getAccessToken(String token)
Returns the access token by the consumer key and token value.

Parameters:
token - access token value
Returns:
access token or null if no such found


Copyright © 2013 Oracle Corporation. All Rights Reserved.