Class DefaultOAuth1Provider.Token
java.lang.Object
org.glassfish.jersey.server.oauth1.DefaultOAuth1Provider.Token
- All Implemented Interfaces:
OAuth1Token
- Enclosing class:
DefaultOAuth1Provider
Simple immutable implementation of
OAuth1Token
.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Token
(String token, String secret, String consumerKey, String callbackUrl, Principal principal, Set<String> roles, javax.ws.rs.core.MultivaluedMap<String, String> attributes) Token
(String token, String secret, String consumerKey, String callbackUrl, Map<String, List<String>> attributes) Token
(String token, String secret, DefaultOAuth1Provider.Token requestToken) -
Method Summary
Modifier and TypeMethodDescriptionprotected DefaultOAuth1Provider.Token
Authorizes this token - i.e.Returns additional custom attributes associated with the token.Returns callback URL for this token (applicable just to request tokens)Returns consumer this token was issued for.Returns aPrincipal
object containing the name of the user the request containing this token is authorized to act on behalf of.Returns the token secret.getToken()
Returns string representing the token.boolean
Returns a boolean indicating whether this token is authorized for the specified logical "role".
-
Field Details
-
token
-
secret
-
consumerKey
-
callbackUrl
-
principal
-
roles
-
attribs
-
-
Constructor Details
-
Token
-
Token
-
Token
-
-
Method Details
-
getToken
Description copied from interface:OAuth1Token
Returns string representing the token.- Specified by:
getToken
in interfaceOAuth1Token
- Returns:
- string representing the token
-
getSecret
Description copied from interface:OAuth1Token
Returns the token secret.- Specified by:
getSecret
in interfaceOAuth1Token
- Returns:
- token secret
-
getConsumer
Description copied from interface:OAuth1Token
Returns consumer this token was issued for.- Specified by:
getConsumer
in interfaceOAuth1Token
- Returns:
- consumer this token was issued for.
-
getAttributes
Description copied from interface:OAuth1Token
Returns additional custom attributes associated with the token. If this is a request token, this should be a the same set or a defined subset of parameters that were passed to theOAuth1Provider.newRequestToken(String, String, java.util.Map)
method that created this request token. If this is an access token, this is any application defined set that will included as form parameters in a response to accessToken request.- Specified by:
getAttributes
in interfaceOAuth1Token
- Returns:
- immutable map of custom attributes
-
getPrincipal
Description copied from interface:OAuth1Token
Returns aPrincipal
object containing the name of the user the request containing this token is authorized to act on behalf of. When the oauth filter verifies the request with this token is properly authenticated, it injects this token into a security context which then delegatesSecurityContext.getUserPrincipal()
to this method.- Specified by:
getPrincipal
in interfaceOAuth1Token
- Returns:
- Principal corresponding to this token, or null if the token is not authorized
-
isInRole
Description copied from interface:OAuth1Token
Returns a boolean indicating whether this token is authorized for the specified logical "role". When the oauth filter verifies the request with this token is properly authenticated, it injects this token into a security context which then delegatesSecurityContext.isUserInRole(String)
to this method.- Specified by:
isInRole
in interfaceOAuth1Token
- Parameters:
role
- aString
specifying the name of the role- Returns:
- a
boolean
indicating whether this token is authorized for a given role
-
getCallbackUrl
Returns callback URL for this token (applicable just to request tokens)- Returns:
- callback url
-
authorize
Authorizes this token - i.e. generates a clone with principal and roles set to the passed values.- Parameters:
principal
- Principal to add to the token.roles
- Roles to add to the token.- Returns:
- Cloned token with the principal and roles set.
-