public class OAuthProxy extends Filter implements OAuthResourceDefs
{ @code OAuthProxy proxy = new OauthProxy(getContext(), true); proxy.setClientId("clientId"); proxy.setClientSecret("clientSecret"); proxy.setRedirectURI("callbackURI"); proxy.setAuthorizationURI("authURI"); proxy.setTokenURI("tokenURI"); proxy.setNext(DummyResource.class); router.attach("/write", write); }
OAuthParameters
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 and Description |
---|
OAuthProxy(Context ctx)
Sets up an OauthProxy.
|
OAuthProxy(Context ctx,
boolean useBasicSecret)
Sets up an OAuthProxy.
|
OAuthProxy(Context ctx,
boolean useBasicSecret,
Client requestClient)
Sets up an OAuthProxy.
|
Modifier and Type | Method and Description |
---|---|
protected int |
beforeHandle(Request request,
Response response) |
protected OAuthParameters |
createAuthorizationRequest() |
protected OAuthParameters |
createTokenRequest(String code) |
String |
getAuthorizationURI() |
String |
getClientId() |
String |
getClientSecret() |
protected Representation |
getErrorPage(Exception ex) |
String |
getRedirectURI() |
String[] |
getScope() |
String |
getTokenURI() |
static String |
getVersion()
Returns the current proxy's version.
|
void |
setAuthorizationURI(String authorizationURI) |
void |
setClientId(String clientId) |
void |
setClientSecret(String clientSecret) |
void |
setRedirectURI(String redirectURI) |
void |
setScope(String[] scope) |
void |
setTokenURI(String tokenURI) |
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
public OAuthProxy(Context ctx)
ctx
- The Restlet context.public OAuthProxy(Context ctx, boolean useBasicSecret)
useBasicSecret
- If true use http basic authentication otherwise use form
based.ctx
- The Restlet context.public OAuthProxy(Context ctx, boolean useBasicSecret, Client requestClient)
useBasicSecret
- If true use http basic authentication otherwise use form
based.ctx
- The Restlet context.requestClient
- A predefined client that will be used for remote client
request. Useful when you need to set e.g. SSL initialization
parameterspublic static String getVersion()
protected int beforeHandle(Request request, Response response)
beforeHandle
in class Filter
protected OAuthParameters createAuthorizationRequest()
protected OAuthParameters createTokenRequest(String code)
public String getAuthorizationURI()
public String getClientId()
public String getClientSecret()
protected Representation getErrorPage(Exception ex)
public String getRedirectURI()
public String[] getScope()
public String getTokenURI()
public void setAuthorizationURI(String authorizationURI)
authorizationURI
- the authorizationURI to setpublic void setClientId(String clientId)
clientId
- the clientId to setpublic void setClientSecret(String clientSecret)
clientSecret
- the clientSecret to setpublic void setRedirectURI(String redirectURI)
redirectURI
- the redirectURI to setpublic void setScope(String[] scope)
scope
- the scope to setpublic void setTokenURI(String tokenURI)
tokenURI
- the tokenURI to setCopyright © 2005-2014 Restlet.