@Provider public class DefaultOAuth1Provider extends Object implements OAuth1Provider
Modifier and Type | Class and Description |
---|---|
static class |
DefaultOAuth1Provider.Consumer
Simple read-only implementation of
OAuth1Consumer . |
class |
DefaultOAuth1Provider.Token
Simple immutable implementation of
OAuth1Token . |
Constructor and Description |
---|
DefaultOAuth1Provider() |
Modifier and Type | Method and Description |
---|---|
void |
addAccessToken(String token,
String secret,
String consumerKey,
String callbackUrl,
Principal principal,
Set<String> roles,
javax.ws.rs.core.MultivaluedMap<String,String> attributes) |
String |
authorizeToken(DefaultOAuth1Provider.Token token,
Principal userPrincipal,
Set<String> roles)
Authorizes a request token for given principal and roles and returns
verifier.
|
OAuth1Token |
getAccessToken(String token)
Returns the access token by the consumer key and token value.
|
Set<DefaultOAuth1Provider.Token> |
getAccessTokens(String principalName)
Returns a list of access tokens authorized with the supplied principal name.
|
DefaultOAuth1Provider.Consumer |
getConsumer(String consumerKey)
Gets consumer corresponding to a given consumer key.
|
Set<DefaultOAuth1Provider.Consumer> |
getConsumers(String owner)
Returns a set of consumers registered by a given owner.
|
DefaultOAuth1Provider.Token |
getRequestToken(String token)
Returns the request token by the consumer key and token value.
|
OAuth1Token |
newAccessToken(OAuth1Token requestToken,
String verifier)
Creates a new access token.
|
OAuth1Token |
newRequestToken(String consumerKey,
String callbackUrl,
Map<String,List<String>> attributes)
Creates a new request token for a given consumerKey.
|
protected String |
newUUIDString()
Generates a new non-guessable random string (used for token/customer
strings, secrets and verifier.
|
DefaultOAuth1Provider.Consumer |
registerConsumer(String owner,
javax.ws.rs.core.MultivaluedMap<String,String> attributes)
Register a new consumer.
|
DefaultOAuth1Provider.Consumer |
registerConsumer(String owner,
String key,
String secret,
javax.ws.rs.core.MultivaluedMap<String,String> attributes)
Register a new consumer configured with Consumer Key.
|
void |
revokeAccessToken(String token,
String principalName)
Checks if the supplied token is authorized for a given principal name
and if so, revokes the authorization.
|
public DefaultOAuth1Provider.Consumer getConsumer(String consumerKey)
OAuth1Provider
getConsumer
in interface OAuth1Provider
consumerKey
- consumer keypublic DefaultOAuth1Provider.Consumer registerConsumer(String owner, javax.ws.rs.core.MultivaluedMap<String,String> attributes)
owner
- Identifier of the owner that registers the consumer (user ID or similar).attributes
- Additional attributes (name-values pairs - to store additional
information about the consumer, such as name, URI, description, etc.)DefaultOAuth1Provider.Consumer
object for the newly registered consumer.public DefaultOAuth1Provider.Consumer registerConsumer(String owner, String key, String secret, javax.ws.rs.core.MultivaluedMap<String,String> attributes)
owner
- Identifier of the owner that registers the consumer (user ID or similar).key
- Consumer key.secret
- Consumer key secret.attributes
- Additional attributes (name-values pairs - to store additional
information about the consumer, such as name, URI, description, etc.)DefaultOAuth1Provider.Consumer
object for the newly registered consumer.public Set<DefaultOAuth1Provider.Consumer> getConsumers(String owner)
owner
- Identifier of the owner that registered the consumers to be retrieved.public Set<DefaultOAuth1Provider.Token> getAccessTokens(String principalName)
principalName
- Principal name for which to retrieve the authorized tokens.public String authorizeToken(DefaultOAuth1Provider.Token token, Principal userPrincipal, Set<String> roles)
token
- Request token to authorize.userPrincipal
- User principal to authorize the token for.roles
- Set of roles to authorize the token for.public void revokeAccessToken(String token, String principalName)
token
- Access token to revoke the authorization for.principalName
- Principal name the token is currently authorized for.protected String newUUIDString()
public DefaultOAuth1Provider.Token getRequestToken(String token)
OAuth1Provider
getRequestToken
in interface OAuth1Provider
token
- request token valuepublic OAuth1Token newRequestToken(String consumerKey, String callbackUrl, Map<String,List<String>> attributes)
OAuth1Provider
newRequestToken
in interface OAuth1Provider
consumerKey
- consumer key to create a request token forcallbackUrl
- callback url for this request token requestattributes
- additional service provider-specific parameters
(this can be used to indicate what level of access is requested
- i.e. readonly, or r/w, etc.)public OAuth1Token newAccessToken(OAuth1Token requestToken, String verifier)
OAuth1Provider
newAccessToken
in interface OAuth1Provider
requestToken
- authorized request tokenverifier
- verifier passed to the callback after authorizationpublic void addAccessToken(String token, String secret, String consumerKey, String callbackUrl, Principal principal, Set<String> roles, javax.ws.rs.core.MultivaluedMap<String,String> attributes)
public OAuth1Token getAccessToken(String token)
OAuth1Provider
getAccessToken
in interface OAuth1Provider
token
- access token valueCopyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.