Interface OAuth1Token
- All Known Implementing Classes:
DefaultOAuth1Provider.Token
public interface OAuth1Token
Interface representing an OAuth token (i.e. access token or request token).
-
Method Summary
Modifier and TypeMethodDescriptionReturns additional custom attributes associated with the token.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".
-
Method Details
-
getToken
String getToken()Returns string representing the token.- Returns:
- string representing the token
-
getSecret
String getSecret()Returns the token secret.- Returns:
- token secret
-
getConsumer
OAuth1Consumer getConsumer()Returns consumer this token was issued for.- Returns:
- consumer this token was issued for.
-
getAttributes
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.- Returns:
- immutable map of custom attributes
-
getPrincipal
Principal getPrincipal()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.- Returns:
- Principal corresponding to this token, or null if the token is not authorized
-
isInRole
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.- Parameters:
role
- aString
specifying the name of the role- Returns:
- a
boolean
indicating whether this token is authorized for a given role
-