org.restlet.ext.oauth
Class AccessTokenServerResource

java.lang.Object
  extended by org.restlet.resource.Resource
      extended by org.restlet.resource.UniformResource
          extended by org.restlet.resource.ServerResource
              extended by org.restlet.ext.oauth.OAuthServerResource
                  extended by org.restlet.ext.oauth.AccessTokenServerResource

public class AccessTokenServerResource
extends OAuthServerResource

Server resource used to acquire an OAuth token. A code, or refresh token can be exchanged for a working token. This resource also supports the none flow. Note: at the moment password and assertion flows are not supported. Implements OAuth 2.0 draft 10 Example. Attach an AccessTokenServerResource

 {
      @code
      public Restlet createInboundRoot(){
              ...
              root.attach("/access_token", AccessTokenServerResource.class);
              ...
      }
 }
 

Author:
Kristoffer Gronowski
See Also:
OAuth 2 draft 10

Field Summary
 
Fields inherited from class org.restlet.ext.oauth.OAuthServerResource
ACCESS_TOKEN, ASSERTION, ASSERTION_TYPE, AUTONOMOUS_USER, CLIENT_ID, CLIENT_SECRET, ClientCookieID, clients, CODE, ERROR, ERROR_DESC, ERROR_URI, EXPIRES_IN, generator, GRANT_TYPE, noCache, noStore, OAUTH_TOKEN, PASSWORD, REDIR_URI, REFRESH_TOKEN, RESPONSE_TYPE, SCOPE, STATE, TOKEN_SERVER_MAX_TIME_SEC, TOKEN_SERVER_TIME_SEC, tokenMaxTimeSec, tokenTimeSec, USERNAME
 
Constructor Summary
AccessTokenServerResource()
           
 
Method Summary
 Representation represent(Representation input)
          Handles the Post request.
protected  Representation sendError(OAuthError error, String description, String errorUri)
          Returns the representation of the given error.
 
Methods inherited from class org.restlet.ext.oauth.OAuthServerResource
doInit, generateAgentToken, generateCode, getParameter, parseScope
 
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, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, 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
 

Constructor Detail

AccessTokenServerResource

public AccessTokenServerResource()
Method Detail

represent

@Post(value="form:json")
public Representation represent(Representation input)
Handles the Post request.

Parameters:
input - HTML form formated token request per oauth-v2 spec.
Returns:
JSON response with token or error.

sendError

protected Representation sendError(OAuthError error,
                                   String description,
                                   String errorUri)
Returns the representation of the given error.

Parameters:
error - The OAuth error.
description - The error description.
errorUri - the error URI.
Returns:
The representation of the given error.


Copyright © 2005-2013 Restlet.