|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dyuproject.oauth.Consumer
public final class Consumer
OAuth Consumer helper class which manages the oauth consumer lifecycle
Field Summary | |
---|---|
static String |
DEFAULT_RESOURCE_PATH
The default resource path. |
Constructor Summary | |
---|---|
Consumer(ConsumerContext context,
TokenManager manager)
|
Method Summary | |
---|---|
void |
addEndpoint(Endpoint ep)
Adds an endpoint ep which would also be added
to the wrapped ConsumerContext . |
HttpConnector.Response |
fetchToken(Endpoint ep,
Token token)
Fetches the token using the given endpoint and token - and returns the http response HttpConnector.Response . |
HttpConnector.Response |
fetchToken(Endpoint ep,
TokenExchange exchange,
Token token)
Fetches the token using the given endpoint, exchange and token - and returns the http response HttpConnector.Response . |
HttpConnector.Response |
fetchToken(Endpoint ep,
UrlEncodedParameterMap params,
TokenExchange exchange,
Token token)
Fetches the token using the given endpoint, params, exchange and token - and returns the http response HttpConnector.Response . |
ConsumerContext |
getConsumerContext()
Gets the consumer context. |
Endpoint |
getEndpoint(String domain)
Gets the endpoint from the given domain . |
static Consumer |
getInstance()
Gets the instance configured from the default resource path DEFAULT_RESOURCE_PATH . |
Token |
getToken(String consumerKey,
HttpServletRequest request)
Gets a token from the request and delegates to the wrapped
TokenManager if not found. |
TokenManager |
getTokenManager()
Gets the token manager. |
boolean |
invalidate(String consumerKey,
HttpServletRequest request,
HttpServletResponse response)
Invalidates the token based from its key; Delegates to the TokenManager . |
boolean |
invalidate(Token token,
HttpServletRequest request,
HttpServletResponse response)
Invalidates the token.; Delegates to the TokenManager . |
static Consumer |
newInstance(InputStream in)
Creates a new instance configured from the InputStream in . |
static Consumer |
newInstance(Properties props)
Creates a new instance configured form the Properties props . |
static Consumer |
newInstance(String resourceLoc)
Creates a new instance configured from the resource path resourceLoc . |
static Consumer |
newInstance(URL resource)
Creates a new instance configured from the URL resource . |
boolean |
saveToken(Token token,
HttpServletRequest request,
HttpServletResponse response)
Saves the token; Delegates to the TokenManager . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_RESOURCE_PATH
Constructor Detail |
---|
public Consumer(ConsumerContext context, TokenManager manager)
Method Detail |
---|
public static Consumer getInstance()
DEFAULT_RESOURCE_PATH
.
public static Consumer newInstance(String resourceLoc)
resourceLoc
.
public static Consumer newInstance(URL resource) throws IOException
URL
resource
.
IOException
public static Consumer newInstance(InputStream in) throws IOException
InputStream
in
.
IOException
public static Consumer newInstance(Properties props) throws IOException
Properties
props
.
IOException
public ConsumerContext getConsumerContext()
public TokenManager getTokenManager()
public Endpoint getEndpoint(String domain)
domain
.
public void addEndpoint(Endpoint ep)
ep
which would also be added
to the wrapped ConsumerContext
.
public Token getToken(String consumerKey, HttpServletRequest request) throws IOException
request
and delegates to the wrapped
TokenManager
if not found. The new token will be set in the
request attribute.
IOException
public boolean saveToken(Token token, HttpServletRequest request, HttpServletResponse response) throws IOException
TokenManager
.
IOException
public boolean invalidate(String consumerKey, HttpServletRequest request, HttpServletResponse response) throws IOException
TokenManager
.
IOException
public boolean invalidate(Token token, HttpServletRequest request, HttpServletResponse response) throws IOException
TokenManager
.
IOException
public HttpConnector.Response fetchToken(Endpoint ep, Token token) throws IOException
HttpConnector.Response
.
IOException
public HttpConnector.Response fetchToken(Endpoint ep, TokenExchange exchange, Token token) throws IOException
HttpConnector.Response
.
IOException
public HttpConnector.Response fetchToken(Endpoint ep, UrlEncodedParameterMap params, TokenExchange exchange, Token token) throws IOException
HttpConnector.Response
.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |