org.restlet.ext.oauth
Class AuthorizationServerResource
java.lang.Object
org.restlet.resource.Resource
org.restlet.resource.ServerResource
org.restlet.ext.oauth.OAuthServerResource
org.restlet.ext.oauth.AuthorizationBaseServerResource
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
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 |
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 |
PARAMETER_SUPPORT_POST
public static final String PARAMETER_SUPPORT_POST
- See Also:
- Constant Field Values
AuthorizationServerResource
public AuthorizationServerResource()
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
Copyright © 2005-2014 Restlet.