|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.veriplace.oauth.consumer.Consumer
public class Consumer
Consumer representation as defined by OAuth 1.0, section 4.
| Field Summary | |
|---|---|
protected Client |
client
Client to use for requests. |
protected java.lang.String |
consumerKey
The OAuth consumer key. |
protected java.lang.String |
consumerSecret
The OAuth consumer secret. |
protected NonceFactory |
nonceFactory
Factory for generating a nonce. |
protected Revision |
revision
Revision of OAuth to use for requests, e.g. |
protected ServiceProvider |
serviceProvider
The OAuth service provider that issues the consumer key and secret and that will be asked for authorization. |
protected TimestampFactory |
timestampFactory
Factory for generating a timestamp. |
| Constructor Summary | |
|---|---|
Consumer(java.lang.String consumerKey,
java.lang.String consumerSecret,
ServiceProvider serviceProvider)
Create a Consumer of OAuth. |
|
Consumer(java.lang.String consumerKey,
java.lang.String consumerSecret,
ServiceProvider serviceProvider,
Revision revision)
Create a Consumer of OAuth. |
|
| Method Summary | |
|---|---|
protected Request |
createRequest(java.net.URL requestUrl,
RequestType requestType,
RequestMethod requestMethod,
ParameterSet requestParameters,
ParameterSet additionalParameters,
java.lang.Integer soTimeout,
Token token,
java.lang.String contentType,
SignatureMethod... signatureMethods)
Generalized request factory method. |
Token |
getAccessToken(RequestMethod requestMethod,
Token requestToken,
java.lang.String verifier,
java.lang.Integer soTimeout,
SignatureMethod... signatureMethods)
Get an access token using custom arguments. |
Token |
getAccessToken(Token requestToken)
Get an access token using POST, HMAC-SHA1, and no additional parameters. |
Token |
getAccessToken(Token requestToken,
java.lang.String verifier)
Get an access token using POST, HMAC-SHA1, and no additional parameters. |
Client |
getClient()
Get the current Client instance. |
java.lang.String |
getConsumerKey()
Get the consumer key value. |
java.lang.String |
getConsumerSecret()
Get the consumer secret value. |
Response |
getProtectedResource(java.net.URL protectedResourceUrl,
RequestMethod requestMethod,
ParameterSet additionalParameters,
Token accessToken,
java.lang.Integer soTimeout,
java.lang.String contentType,
SignatureMethod... signatureMethods)
Get a protected resource. |
Response |
getProtectedResource(java.net.URL protectedResourceUrl,
RequestMethod requestMethod,
Token accessToken,
ParameterSet additionalParameters)
Get a protected resource. |
Response |
getProtectedResource(java.net.URL protectedResourceUrl,
RequestMethod requestMethod,
Token accessToken,
ParameterSet additionalParameters,
java.lang.String contentType)
Get a protected resource, specifying the desired content type. |
Token |
getRequestToken()
Get a request token using POST, HMAC-SHA1, and no additional parameters. |
Token |
getRequestToken(RequestMethod requestMethod,
java.lang.String callback,
ParameterSet additionalParameters,
java.lang.Integer soTimeout,
SignatureMethod... signatureMethods)
Get a request token using custom arguments. |
Token |
getRequestToken(java.lang.String callback)
Get a request token using POST, HMAC-SHA1, and an oauth_callback. |
Token |
getRequestToken(java.lang.String callback,
ParameterSet parameters)
Get a request token using POST, HMAC-SHA1, an oauth_callback, and optional special parameters. |
protected Response |
getResponse(Request request)
Generalized request method. |
Revision |
getRevision()
Get the OAuth protocol revision used by this consumer. |
java.lang.String |
getUserAuthorizationUrl(ParameterSet additionalParameters,
Token requestToken)
Get a user authorization URL for redirection using GET. |
java.lang.String |
getUserAuthorizationUrl(ParameterSet additionalParameters,
Token requestToken,
java.lang.Integer soTimeout)
Get a user authorization URL for redirection using GET. |
void |
setClient(Client client)
Consumer supports alternate Client implementations,
especially for test scenarios. |
void |
setDefaultParameters(ParameterSet requestParameters)
Set default request parameters, including: oauth_version oauth_consumer_key oauth_timestamp oauth_nonce |
void |
setNonceFactory(NonceFactory nonceFactory)
Consumer supports alternate NonceFactory implementations,
especially for test scenarios. |
void |
setTimestampFactory(TimestampFactory timestampFactory)
Consumer supports alternate TimestampFactory implemenations,
especially for test scenarios. |
void |
setTokenParameters(ParameterSet requestParameters,
Token token)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.String consumerKey
protected final java.lang.String consumerSecret
protected final ServiceProvider serviceProvider
protected TimestampFactory timestampFactory
SystemTimestampFactory
protected NonceFactory nonceFactory
IncrementalNonceFactory
protected Client client
CommonsHttpClient
protected final Revision revision
| Constructor Detail |
|---|
public Consumer(java.lang.String consumerKey,
java.lang.String consumerSecret,
ServiceProvider serviceProvider)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public Consumer(java.lang.String consumerKey,
java.lang.String consumerSecret,
ServiceProvider serviceProvider,
Revision revision)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException| Method Detail |
|---|
public final java.lang.String getConsumerKey()
public final java.lang.String getConsumerSecret()
public Client getClient()
Client instance.
public Revision getRevision()
public void setTimestampFactory(TimestampFactory timestampFactory)
TimestampFactory implemenations,
especially for test scenarios.
public void setNonceFactory(NonceFactory nonceFactory)
NonceFactory implementations,
especially for test scenarios.
public void setClient(Client client)
Client implementations,
especially for test scenarios.
public Token getRequestToken()
throws OAuthException,
java.io.IOException
This method should only be used for OAuth Core (not Rev A).
OAuthException
java.io.IOException
public Token getRequestToken(java.lang.String callback)
throws OAuthException,
java.io.IOException
This method should be used for OAuth Core Rev A.
OAuthException
java.io.IOException
public Token getRequestToken(java.lang.String callback,
ParameterSet parameters)
throws OAuthException,
java.io.IOException
This method should be used for OAuth Core Rev A.
OAuthException
java.io.IOException
public Token getAccessToken(Token requestToken)
throws OAuthException,
java.io.IOException
This method should only be used for OAuth Core (not Rev A).
requestToken - the requestToken for this request
OAuthException
java.io.IOException
public Token getAccessToken(Token requestToken,
java.lang.String verifier)
throws OAuthException,
java.io.IOException
This method should be used for OAuth Core Rev A.
requestToken - the requestToken for this requestverifier - the verifier value from the callback
OAuthException
java.io.IOException
public java.lang.String getUserAuthorizationUrl(ParameterSet additionalParameters,
Token requestToken)
throws OAuthException,
java.io.IOException
additionalParameters - any additional parameters to be sent, may be nullrequestToken - the requestToken for this request
OAuthException
java.io.IOException
public Response getProtectedResource(java.net.URL protectedResourceUrl,
RequestMethod requestMethod,
Token accessToken,
ParameterSet additionalParameters,
java.lang.String contentType)
throws OAuthException,
java.io.IOException
protectedResourceUrl - the URL of the protected resourcerequestMethod - the request method to use (e.g. GET or POST)accessToken - the accessToken for this resourceadditionalParameters - any additional parameters to be sent, may be nullcontentType - the desired MIME content type of the resource
OAuthException
java.io.IOException
public Response getProtectedResource(java.net.URL protectedResourceUrl,
RequestMethod requestMethod,
Token accessToken,
ParameterSet additionalParameters)
throws OAuthException,
java.io.IOException
protectedResourceUrl - the URL of the protected resourcerequestMethod - the request method to use (e.g. GET or POST)additionalParameters - any additional parameters to be sent, may be nullaccessToken - the accessToken for this resource
OAuthException
java.io.IOException
public Token getRequestToken(RequestMethod requestMethod,
java.lang.String callback,
ParameterSet additionalParameters,
java.lang.Integer soTimeout,
SignatureMethod... signatureMethods)
throws OAuthException,
java.io.IOException
requestMethod - the request method to use (POST is default)callback - the oauth_callback as required by OAuth Core 1.0 Rev AadditionalParameters - any additional parameters to be sent, may be nullsoTimeout - read socket timeoutsignatureMethods - the desired signature method(s), in order of preference
OAuthException - if the server returns an OAuth error
java.io.IOException - if there is an I/O error in communication with the server
public java.lang.String getUserAuthorizationUrl(ParameterSet additionalParameters,
Token requestToken,
java.lang.Integer soTimeout)
throws OAuthException,
java.io.IOException
additionalParameters - any additional parameters to be sent, may be nullrequestToken - the requestToken for this requestsoTimeout - read socket timeout
OAuthException
java.io.IOException
public Token getAccessToken(RequestMethod requestMethod,
Token requestToken,
java.lang.String verifier,
java.lang.Integer soTimeout,
SignatureMethod... signatureMethods)
throws OAuthException,
java.io.IOException
requestMethod - the request method to use (POST is default)requestToken - the requestToken for this requestsoTimeout - read socket timeoutsignatureMethods - the desired signature method(s), in order of preference
OAuthException - if the server returns an OAuth error
java.io.IOException - if there is an I/O error in communication with the server
public Response getProtectedResource(java.net.URL protectedResourceUrl,
RequestMethod requestMethod,
ParameterSet additionalParameters,
Token accessToken,
java.lang.Integer soTimeout,
java.lang.String contentType,
SignatureMethod... signatureMethods)
throws OAuthException,
java.io.IOException
protectedResourceUrl - the URL of the protected resourcerequestMethod - the request method to use (e.g. GET or POST)additionalParameters - any additional parameters to be sent, may be nullsoTimeout - read socket timeoutaccessToken - the accessToken for this resourcecontentType - the desired MIME content type, if anysignatureMethods - the desired signature method(s), in order of preference
OAuthException
java.io.IOException
protected Request createRequest(java.net.URL requestUrl,
RequestType requestType,
RequestMethod requestMethod,
ParameterSet requestParameters,
ParameterSet additionalParameters,
java.lang.Integer soTimeout,
Token token,
java.lang.String contentType,
SignatureMethod... signatureMethods)
throws OAuthException,
java.io.IOException
OAuthException
java.io.IOException
protected Response getResponse(Request request)
throws OAuthException,
java.io.IOException
OAuthException - if the server returns an OAuth error
java.io.IOException - if there is an I/O error in communication with the serverpublic void setDefaultParameters(ParameterSet requestParameters)
public void setTokenParameters(ParameterSet requestParameters,
Token token)
throws OAuthException
OAuthException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||