Restlet Framework 2.2.1
OSGi Environments

org.restlet.ext.oauth
Class AuthorizationBaseServerResource

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
All Implemented Interfaces:
OAuthResourceDefs
Direct Known Subclasses:
AuthorizationServerResource, AuthPageServerResource

public class AuthorizationBaseServerResource
extends OAuthServerResource

Base Restlet resource class for Authorization service resource. Handle errors according to OAuth2.0 specification, and manage AuthSession. Authorization Endndpoint, Authorization pages, and Login pages should extends this class.

Author:
Shotaro Uchida

Field Summary
 
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
AuthorizationBaseServerResource()
           
 
Method Summary
protected  void doCatch(Throwable t)
           
protected  org.restlet.ext.oauth.internal.AuthSession getAuthSession()
          Returns the current authorization session.
protected  Representation getErrorPage(String errPage, OAuthException ex)
          Helper method to format error responses according to OAuth2 spec.
protected  void sendError(String redirectURI, OAuthException ex, String state, boolean fragment)
          Helper method to format error responses according to OAuth2 spec.
protected  org.restlet.ext.oauth.internal.AuthSession setupAuthSession(org.restlet.ext.oauth.internal.RedirectionURI redirectUri)
          Sets up a new authorization session.
protected  void ungetAuthSession()
          Unget current authorization session.
 
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
 

Constructor Detail

AuthorizationBaseServerResource

public AuthorizationBaseServerResource()
Method Detail

doCatch

protected void doCatch(Throwable t)
Overrides:
doCatch in class ServerResource

setupAuthSession

protected org.restlet.ext.oauth.internal.AuthSession setupAuthSession(org.restlet.ext.oauth.internal.RedirectionURI redirectUri)
Sets up a new authorization session.

Parameters:
redirectUri - The redirection URI.

getAuthSession

protected org.restlet.ext.oauth.internal.AuthSession getAuthSession()
                                                             throws OAuthException
Returns the current authorization session.

Returns:
The current AuthSession instance.
Throws:
OAuthException

ungetAuthSession

protected void ungetAuthSession()
Unget current authorization session.


sendError

protected void sendError(String redirectURI,
                         OAuthException ex,
                         String state,
                         boolean fragment)
Helper method to format error responses according to OAuth2 spec. (Redirect)

Parameters:
redirectURI - redirection URI to send error
ex - Any OAuthException with error
state - state parameter as presented in the initial authorize request
fragment - true if use URL Fragment.

getErrorPage

protected Representation getErrorPage(String errPage,
                                      OAuthException ex)
Helper method to format error responses according to OAuth2 spec. (Non Redirect)

Parameters:
errPage - errorPage template name
ex - Any OAuthException with error

Restlet Framework 2.2.1
OSGi Environments

Copyright © 2005-2014 Restlet.