|
Restlet Framework 2.2.2 OSGi Environments |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.resource.Resource
org.restlet.resource.ServerResource
org.restlet.ext.oauth.OAuthServerResource
org.restlet.ext.oauth.AccessTokenServerResource
public class AccessTokenServerResource
Server resource used to acquire an OAuth token. A code, or refresh token can be exchanged for a working token. Implements OAuth 2.0 (RFC6749) Example. Attach an AccessTokenServerResource
{ @code public Restlet createInboundRoot(){ ... root.attach("/token", AccessTokenServerResource.class); ... } }
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 | |
---|---|
AccessTokenServerResource()
|
Method Summary | |
---|---|
protected void |
doCatch(Throwable t)
Handle errors as described in 5.2 Error Response. |
protected void |
ensureGrantTypeAllowed(org.restlet.ext.oauth.internal.Client client,
GrantType grantType)
|
protected org.restlet.ext.oauth.internal.Client |
getAuthenticatedClient()
|
protected org.restlet.ext.oauth.internal.Client |
getClient(Form params)
Get request parameter "client_id". |
protected String |
getCode(Form params)
Get request parameter "code". |
protected GrantType |
getGrantType(Form params)
Get request parameter "grant_type". |
protected String |
getPassword(Form params)
Get request parameter "password". |
protected String |
getRedirectURI(Form params)
Get request parameter "redirect_uri". |
protected String |
getRefreshToken(Form params)
Get request parameter "refresh_token". |
protected String |
getUsername(Form params)
Get request parameter "username". |
Representation |
requestToken(Representation input)
Handles the Post request. |
protected Representation |
responseTokenRepresentation(org.restlet.ext.oauth.internal.Token token,
String[] requestedScope)
Response JSON document with valid token. |
Methods inherited from class org.restlet.ext.oauth.OAuthServerResource |
---|
addCacheDirective, doInit, getScope, getState, responseErrorRepresentation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AccessTokenServerResource()
Method Detail |
---|
protected org.restlet.ext.oauth.internal.Client getAuthenticatedClient() throws OAuthException
OAuthException
protected org.restlet.ext.oauth.internal.Client getClient(Form params) throws OAuthException
OAuthServerResource
getClient
in class OAuthServerResource
OAuthException
protected void ensureGrantTypeAllowed(org.restlet.ext.oauth.internal.Client client, GrantType grantType) throws OAuthException
OAuthException
@Post(value="form:json") public Representation requestToken(Representation input) throws OAuthException, JSONException
Post
request. The client MUST use the HTTP "POST"
method when making access token requests. (3.2. Token Endpoint)
input
- HTML form formated token request per oauth-v2 spec.
OAuthException
JSONException
protected void doCatch(Throwable t)
doCatch
in class ServerResource
t
- protected GrantType getGrantType(Form params) throws OAuthException
params
-
OAuthException
protected String getCode(Form params) throws OAuthException
params
-
OAuthException
protected String getRedirectURI(Form params) throws OAuthException
params
-
OAuthException
protected String getUsername(Form params) throws OAuthException
params
-
OAuthException
protected String getPassword(Form params) throws OAuthException
params
-
OAuthException
protected String getRefreshToken(Form params) throws OAuthException
params
-
OAuthException
protected Representation responseTokenRepresentation(org.restlet.ext.oauth.internal.Token token, String[] requestedScope) throws JSONException
token
- The token generated by the client.requestedScope
- The scope originally requested by the client.
ResourceException
JSONException
|
Restlet Framework 2.2.2 OSGi Environments |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |