Restlet Framework 2.2.2
Java Standard Edition

org.restlet.ext.oauth
Class AuthorizationServerResource

java.lang.Object
  extended by org.restlet.resource.Resource
      extended by org.restlet.resource.ServerResource
          extended by org.restlet.ext.oauth.OAuthServerResource
              extended by org.restlet.ext.oauth.AuthorizationBaseServerResource
                  extended by org.restlet.ext.oauth.AuthorizationServerResource
All Implemented Interfaces:
OAuthResourceDefs

public class AuthorizationServerResource
extends AuthorizationBaseServerResource

Restlet implementation class AuthorizationService. Used for initiating an OAuth 2.0 authorization request. This Resource is controlled by to Context Attribute Parameters Implements OAuth 2.0 (RFC6749) The following example shows how to set up a simple Authorization Service.

 {
      @code
      public Restlet createInboundRoot(){
      ...
      ChallengeAuthenticator au = new ChallengeAuthenticator(getContext(),
              ChallengeScheme.HTTP_BASIC, "OAuth Test Server");
      au.setVerifier(new MyVerifier());
      au.setNext(AuthorizationServerResource.class);
      root.attach("/authorize", au);
      ...
 }
 

Author:
Shotaro Uchida , Martin Svensson
See Also:
OAuth 2.0

Field Summary
static String PARAMETER_SUPPORT_POST
           
 
Fields inherited from class org.restlet.ext.oauth.OAuthServerResource
clients, PARAMETER_DEFAULT_SCOPE, 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
AuthorizationServerResource()
           
 
Method Summary
protected  Representation doPostAuthorization(org.restlet.ext.oauth.internal.AuthSession session, org.restlet.ext.oauth.internal.Client client)
          Handle the authorization request.
protected  org.restlet.ext.oauth.internal.RedirectionURI getRedirectionURI(Form params, org.restlet.ext.oauth.internal.Client client)
          Get request parameter "redirect_uri".
protected  ResponseType[] getResponseType(Form params)
          Get request parameter "response_type".
 Representation requestAuthorization()
           
 Representation requestAuthorization(Form params)
          Checks that all incoming requests have a type parameter.
 Representation requestAuthorization(Representation input)
           
 
Methods inherited from class org.restlet.ext.oauth.AuthorizationBaseServerResource
doCatch, getAuthSession, getErrorPage, sendError, setupAuthSession, ungetAuthSession
 
Methods inherited from class org.restlet.ext.oauth.OAuthServerResource
addCacheDirective, doInit, getClient, getScope, getState, responseErrorRepresentation
 
Methods inherited from class org.restlet.resource.ServerResource
abort, commit, delete, delete, describeVariants, 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_SUPPORT_POST

public static final String PARAMETER_SUPPORT_POST
See Also:
Constant Field Values
Constructor Detail

AuthorizationServerResource

public AuthorizationServerResource()
Method Detail

requestAuthorization

@Post(value="html")
public Representation requestAuthorization(Representation input)
                                    throws OAuthException
Throws:
OAuthException

requestAuthorization

@Get(value="html")
public Representation requestAuthorization()
                                    throws OAuthException
Throws:
OAuthException

requestAuthorization

public Representation requestAuthorization(Form params)
                                    throws OAuthException
Checks that all incoming requests have a type parameter. Requires response_type, client_id and redirect_uri parameters. For the code flow client_secret is also mandatory.

Throws:
OAuthException

doPostAuthorization

protected Representation doPostAuthorization(org.restlet.ext.oauth.internal.AuthSession session,
                                             org.restlet.ext.oauth.internal.Client client)
Handle the authorization request.

Parameters:
session - The OAuth session.
Returns:
The result as a Representation.

getResponseType

protected ResponseType[] getResponseType(Form params)
                                  throws OAuthException
Get request parameter "response_type".

Parameters:
params -
Returns:
Throws:
OAuthException

getRedirectionURI

protected org.restlet.ext.oauth.internal.RedirectionURI getRedirectionURI(Form params,
                                                                          org.restlet.ext.oauth.internal.Client client)
                                                                   throws OAuthException
Get request parameter "redirect_uri". (See 3.1.2.3. Dynamic Configuration)

Parameters:
params -
client -
Returns:
Throws:
OAuthException

Restlet Framework 2.2.2
Java Standard Edition

Copyright © 2005-2014 Restlet.