Restlet Framework 2.2.1
Java Standard Edition

org.restlet.ext.oauth
Class OAuthServerResource

java.lang.Object
  extended by org.restlet.resource.Resource
      extended by org.restlet.resource.ServerResource
          extended by org.restlet.ext.oauth.OAuthServerResource
All Implemented Interfaces:
OAuthResourceDefs
Direct Known Subclasses:
AccessTokenServerResource, AuthorizationBaseServerResource, TokenAuthServerResource

public abstract class OAuthServerResource
extends ServerResource
implements OAuthResourceDefs

Base class for common resources used by the OAuth server side. Implements OAuth 2.0 (RFC6749)

Author:
Shotaro Uchida , Kristoffer Gronowski

Field Summary
protected  org.restlet.ext.oauth.internal.ClientManager clients
           
static String PARAMETER_DEFAULT_SCOPE
           
protected  org.restlet.ext.oauth.internal.TokenManager tokens
           
 
Fields inherited from interface org.restlet.ext.oauth.OAuthResourceDefs
ACCESS_TOKEN, CLIENT_ID, CLIENT_SECRET, CODE, ERROR, ERROR_DESC, ERROR_URI, EXPIRES_IN, GRANT_TYPE, PASSWORD, REDIR_URI, REFRESH_TOKEN, RESPONSE_TYPE, SCOPE, STATE, TOKEN_TYPE, TOKEN_TYPE_BEARER, TOKEN_TYPE_MAC, USERNAME
 
Constructor Summary
OAuthServerResource()
          Default constructor.
 
Method Summary
static void addCacheDirective(Response response, CacheDirective cacheDirective)
           
protected  void doInit()
           
protected  org.restlet.ext.oauth.internal.Client getClient(Form params)
          Get request parameter "client_id".
protected  String[] getScope(Form params)
          Get request parameter "scope".
protected  String getState(Form params)
          Get request parameter "state".
static Representation responseErrorRepresentation(OAuthException ex)
          Returns the representation of the given error.
 
Methods inherited from class org.restlet.resource.ServerResource
abort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, get, getAttribute, getInfo, getInfo, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDimensions, setExisting, setLocationRef, setLocationRef, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
 
Methods inherited from class org.restlet.resource.Resource
doError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toObject, toRepresentation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_DEFAULT_SCOPE

public static final String PARAMETER_DEFAULT_SCOPE
See Also:
Constant Field Values

clients

protected volatile org.restlet.ext.oauth.internal.ClientManager clients

tokens

protected volatile org.restlet.ext.oauth.internal.TokenManager tokens
Constructor Detail

OAuthServerResource

public OAuthServerResource()
Default constructor.

Method Detail

doInit

protected void doInit()
               throws ResourceException
Overrides:
doInit in class Resource
Throws:
ResourceException

getClient

protected org.restlet.ext.oauth.internal.Client getClient(Form params)
                                                   throws OAuthException
Get request parameter "client_id".

Parameters:
params -
Returns:
Throws:
OAuthException

getScope

protected String[] getScope(Form params)
                     throws OAuthException
Get request parameter "scope".

Parameters:
params -
Returns:
Throws:
OAuthException

getState

protected String getState(Form params)
Get request parameter "state".

Parameters:
params -
Returns:
Throws:
OAuthException

responseErrorRepresentation

public static Representation responseErrorRepresentation(OAuthException ex)
Returns the representation of the given error. The format of the JSON document is according to 5.2. Error Response.

Parameters:
ex - Any OAuthException with error
Returns:
The representation of the given error.

addCacheDirective

public static void addCacheDirective(Response response,
                                     CacheDirective cacheDirective)

Restlet Framework 2.2.1
Java Standard Edition

Copyright © 2005-2014 Restlet.