Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.oauth.server.api.providers
Class DefaultOAuthProvider.Token

    java.lang.Object
      com.sun.jersey.oauth.server.api.providers.DefaultOAuthProvider.Token

All Implemented Interfaces:
  OAuthToken

Enclosing class:
  DefaultOAuthProvider

    public class DefaultOAuthProvider.Token

extends java.lang.Object
implements OAuthToken

Simple immutable implementation of `OAuthToken`.

Constructor Summary
`` | `DefaultOAuthProvider.Token(java.lang.String token, java.lang.String secret, DefaultOAuthProvider.Token requestToken)`
`` | `DefaultOAuthProvider.Token(java.lang.String token, java.lang.String secret, java.lang.String consumerKey, java.lang.String callbackUrl, java.util.Map<java.lang.String,java.util.List<java.lang.String>> attributes)`
`protected` | `DefaultOAuthProvider.Token(java.lang.String token, java.lang.String secret, java.lang.String consumerKey, java.lang.String callbackUrl, java.security.Principal principal, java.util.Set<java.lang.String> roles, MultivaluedMap<java.lang.String,java.lang.String> attributes)`

Method Summary
`protected DefaultOAuthProvider.Token` | `authorize(java.security.Principal principal, java.util.Set<java.lang.String> roles)` Authorizes this token - i.e.
`MultivaluedMap<java.lang.String,java.lang.String>` | `getAttributes()` Returns additional custom attributes associated with the token.
`java.lang.String` | `getCallbackUrl()` Returns callback URL for this token (applicable just to request tokens)
`OAuthConsumer` | `getConsumer()` Returns consumer this token was issued for.
`java.security.Principal` | `getPrincipal()` Returns a `Principal` object containing the name of the user the request containing this token is authorized to act on behalf of.
`java.lang.String` | `getSecret()` Returns the token secret.
`java.lang.String` | `getToken()` Returns string representing the token.
`boolean` | `isInRole(java.lang.String role)` Returns a boolean indicating whether this token is authorized for the specified logical "role".

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultOAuthProvider.Token

    protected DefaultOAuthProvider.Token(java.lang.String token,
                                         java.lang.String secret,
                                         java.lang.String consumerKey,
                                         java.lang.String callbackUrl,
                                         java.security.Principal principal,
                                         java.util.Set<java.lang.String> roles,
                                         MultivaluedMap<java.lang.String,java.lang.String> attributes)

### DefaultOAuthProvider.Token

    public DefaultOAuthProvider.Token(java.lang.String token,
                                      java.lang.String secret,
                                      java.lang.String consumerKey,
                                      java.lang.String callbackUrl,
                                      java.util.Map<java.lang.String,java.util.List<java.lang.String>> attributes)

### DefaultOAuthProvider.Token

    public DefaultOAuthProvider.Token(java.lang.String token,
                                      java.lang.String secret,
                                      DefaultOAuthProvider.Token requestToken)

Method Detail

### getToken

    public java.lang.String getToken()

  Description copied from interface: `OAuthToken`
  Returns string representing the token.

  Specified by:
    `getToken` in interface `OAuthToken`
  Returns:
    string representing the token

### getSecret

    public java.lang.String getSecret()

  Description copied from interface: `OAuthToken`
  Returns the token secret.

  Specified by:
    `getSecret` in interface `OAuthToken`
  Returns:
    token secret

### getConsumer

    public OAuthConsumer getConsumer()

  Description copied from interface: `OAuthToken`
  Returns consumer this token was issued for.

  Specified by:
    `getConsumer` in interface `OAuthToken`
  Returns:
    consumer this token was issued for.

### getAttributes

    public MultivaluedMap<java.lang.String,java.lang.String> getAttributes()

  Description copied from interface: `OAuthToken`
  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 the `OAuthProvider#newRequestToken(java.lang.String, java.lang.String, javax.ws.rs.core.MultivaluedMap)` 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 interface `OAuthToken`
  Returns:
    immutable map of custom attributes

### getPrincipal

    public java.security.Principal getPrincipal()

  Description copied from interface: `OAuthToken`
  Returns a `Principal` 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 delegates `SecurityContext.getUserPrincipal()` to this method.

  Specified by:
    `getPrincipal` in interface `OAuthToken`
  Returns:
    Principal corresponding to this token, or null if the token is not authorized

### isInRole

    public boolean isInRole(java.lang.String role)

  Description copied from interface: `OAuthToken`
  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 delegates `SecurityContext.isUserInRole(java.lang.String)` to this method.

  Specified by:
    `isInRole` in interface `OAuthToken`
  Parameters:
    `role` - a `String` specifying the name of the role
  Returns:
    a `boolean` indicating whether this token is authorized for a given role

### getCallbackUrl

    public java.lang.String getCallbackUrl()

  Returns callback URL for this token (applicable just to request tokens)

  Returns:
    callback url

### authorize

    protected DefaultOAuthProvider.Token authorize(java.security.Principal principal,
                                                   java.util.Set<java.lang.String> roles)

  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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011 Oracle Corporation. All Rights Reserved.