|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Restlet
org.restlet.routing.Filter
org.restlet.ext.oauth.OAuthProxy
public class OAuthProxy
A restlet filter for initiating a web server flow or comparable to OAuth 2.0 3-legged authorization. On successful execution a working OAuth token will be maintained. It is recommended to put a ServerResource after this filter to display to the end user on successful service setup. The following example shows how to gain an accesstoken that will be available for "DummyResource" to use to access some remote protected resource
{ @code OAuthParameter params = new OAuthParameters("clientId", "clientSecret", oauthURL, "scope1 scope2"); OAuthProxy proxy = new OauthProxy(params, getContext(), true); proxy.setNext(DummyResource.class); router.attach("/write", write); //A Slightly more advanced example that also sets some SSL client parameters Client client = new Client(Protocol.HTTPS); Context c = new Context(); client.setContext(c); c.getParameters().add("truststorePath", "pathToKeyStoreFile"); c.getParameters(0.add("truststorePassword", "password"); OAuthParameter params = new OAuthParameters("clientId", "clientSecret", oauthURL, "scope1 scope2"); OAuthProxy proxy = new OauthProxy(params, getContext(), true, client); proxy.setNext(DummyResource.class); router.attach("/write", write); }
OAuthParameters
Field Summary |
---|
Fields inherited from class org.restlet.routing.Filter |
---|
CONTINUE, SKIP, STOP |
Constructor Summary | |
---|---|
OAuthProxy(OAuthParameters params,
Context ctx)
Sets up an OauthProxy. |
|
OAuthProxy(OAuthParameters params,
Context ctx,
boolean useBasicSecret)
Sets up an OAuthProxy. |
|
OAuthProxy(OAuthParameters params,
Context ctx,
boolean useBasicSecret,
Client requestClient)
Sets up an OAuthProxy. |
|
OAuthProxy(OAuthParameters params,
Context ctx,
boolean useBasicSecret,
Filter interceptor)
Sets up an OAuthProxy. |
Method Summary | |
---|---|
protected int |
beforeHandle(Request request,
Response response)
|
static String |
getVersion()
Returns the current proxy's version. |
void |
start()
|
void |
stop()
|
Methods inherited from class org.restlet.routing.Filter |
---|
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext |
Methods inherited from class org.restlet.Restlet |
---|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OAuthProxy(OAuthParameters params, Context ctx)
params
- The OAuth parameters.ctx
- The Restlet context.public OAuthProxy(OAuthParameters params, Context ctx, boolean useBasicSecret)
params
- The OAuth parameters.useBasicSecret
- If true use http basic authentication otherwise use form
based.ctx
- The Restlet context.public OAuthProxy(OAuthParameters params, Context ctx, boolean useBasicSecret, Filter interceptor)
params
- The OAuth parameters.useBasicSecret
- If true use http basic authentication otherwise use form
based.ctx
- The Restlet context.interceptor
- A predefined client filter that will be used for remote
request. Useful when a community has non complian request
or response parameters that need to be normalized.public OAuthProxy(OAuthParameters params, Context ctx, boolean useBasicSecret, Client requestClient)
params
- The OAuth parameters.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
parametersMethod Detail |
---|
public static String getVersion()
protected int beforeHandle(Request request, Response response)
beforeHandle
in class Filter
public void start() throws Exception
start
in class Filter
Exception
public void stop() throws Exception
stop
in class Filter
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |