Class OAuth1Parameters
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
String>
A data structure class that represents OAuth protocol parameters.
- Author:
- Hubert A. Le Van Gong <hubert.levangong at Sun.COM>, Paul C. Bryan <pbryan@sun.com>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of HTTP authorization header.static final String
Name of parameter containing the callback URL.static final String
Name of parameter containing the token secret.static final String
Name of parameter containing the consumer key.static final String
Default value of the callback URI that should be used during Authorization flow for Request Token request when the client is not capable of handling redirects (e.g. the client is a mobile application).static final String
Name of parameter containing the nonce.static final String
Name of parameter containing the protection realm.static final String
OAuth scheme in Authorization header.static final String
Name of parameter containing the signature.static final String
Name of parameter containing the signature method.static final String
Name of parameter containing the timestamp.static final String
Name of parameter containing the access/request token.static final String
Name of parameter containing the token secret.static final String
Name of parameter containing the verifier code.static final String
Name of parameter containing the protocol version. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionBuilder pattern method to returnOAuth1Parameters
after setting callback URL.clone()
consumerKey
(String consumerKey) Builder pattern method to returnOAuth1Parameters
after setting consumer key.Returns the callback URL.Returns the consumer key.getNonce()
Returns the nonce, a value that should be unique for a given timestamp.getRealm()
Returns the protection realm for the request.Returns the signature for the request.Returns the signature method used to sign the request.Returns the timestamp, a value expected to be a positive integer, typically containing the number of seconds since January 1, 1970 00:00:00 GMT (epoch).getToken()
Returns the request or access token.Returns the verifier code.Returns the protocol version.nonce()
Builder pattern method to returnOAuth1Parameters
after setting nonce to a randomly-generated UUID.Builder pattern method to returnOAuth1Parameters
after setting nonce.readRequest
(OAuth1Request request) Reads a request for OAuth parameters, and populates this object.Builder pattern method to returnOAuth1Parameters
after setting protection realm.void
setCallback
(String callback) Sets the callback URL.void
setConsumerKey
(String consumerKey) Sets the consumer key.void
setNonce()
Sets the nonce to contain a randomly-generated UUID.void
Sets the nonce, a value that should be unique for a given timestamp.void
Sets the protection realm for the request.void
setSignature
(String signature) Sets the signature for the request.void
setSignatureMethod
(String signatureMethod) Sets the signature method used to sign the request.void
Sets the timestamp to the current time as number of seconds since epoch.void
setTimestamp
(String timestamp) Sets the timestamp.void
Sets the request or access token.void
setVerifier
(String verifier) Sets the verifier code.void
Sets the protocol version to the default value of 1.0.void
setVersion
(String version) Sets the protocol version.Builder pattern method to returnOAuth1Parameters
after setting signature.signatureMethod
(String signatureMethod) Builder pattern method to returnOAuth1Parameters
after setting signature method.Builder pattern method to returnOAuth1Parameters
after setting timestamp to the current time.Builder pattern method to returnOAuth1Parameters
after setting timestamp.Builder pattern method to returnOAuth1Parameters
after setting token.Builder pattern method to returnOAuth1Parameters
after setting verifier code.version()
Builder pattern method to returnOAuth1Parameters
after setting version to the default value of 1.0.Builder pattern method to returnOAuth1Parameters
after setting version.writeRequest
(OAuth1Request request) Writes the OAuth parameters to a request, as an Authorization header.Methods inherited from class java.util.HashMap
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
AUTHORIZATION_HEADER
Name of HTTP authorization header.- See Also:
-
SCHEME
OAuth scheme in Authorization header.- See Also:
-
REALM
Name of parameter containing the protection realm.- See Also:
-
CONSUMER_KEY
Name of parameter containing the consumer key.- See Also:
-
TOKEN
Name of parameter containing the access/request token.- See Also:
-
SIGNATURE_METHOD
Name of parameter containing the signature method.- See Also:
-
SIGNATURE
Name of parameter containing the signature.- See Also:
-
TIMESTAMP
Name of parameter containing the timestamp.- See Also:
-
NONCE
Name of parameter containing the nonce.- See Also:
-
VERSION
Name of parameter containing the protocol version.- See Also:
-
VERIFIER
Name of parameter containing the verifier code.- See Also:
-
CALLBACK
Name of parameter containing the callback URL.- See Also:
-
TOKEN_SECRET
Name of parameter containing the token secret. This parameter is never used in requests. It is part of a response to the request token and access token requests.- See Also:
-
CALLBACK_CONFIRMED
Name of parameter containing the token secret. This parameter is never used in requests. It is part of a response to the request token requests.- See Also:
-
NO_CALLBACK_URI_VALUE
Default value of the callback URI that should be used during Authorization flow for Request Token request when the client is not capable of handling redirects (e.g. the client is a mobile application).- See Also:
-
-
Constructor Details
-
OAuth1Parameters
public OAuth1Parameters()
-
-
Method Details
-
getRealm
Returns the protection realm for the request. -
setRealm
Sets the protection realm for the request. -
realm
Builder pattern method to returnOAuth1Parameters
after setting protection realm.- Parameters:
realm
- the protection realm for the request.- Returns:
- this parameters object.
-
getConsumerKey
Returns the consumer key. -
setConsumerKey
Sets the consumer key. -
consumerKey
Builder pattern method to returnOAuth1Parameters
after setting consumer key.- Parameters:
consumerKey
- the consumer key.
-
getToken
Returns the request or access token. -
put
-
setToken
Sets the request or access token. -
token
Builder pattern method to returnOAuth1Parameters
after setting token.- Parameters:
token
- the access or request token.- Returns:
- this parameters object.
-
getSignatureMethod
Returns the signature method used to sign the request. -
setSignatureMethod
Sets the signature method used to sign the request. -
signatureMethod
Builder pattern method to returnOAuth1Parameters
after setting signature method.- Parameters:
signatureMethod
- the signature method used to sign the request.- Returns:
- this parameters object.
-
getSignature
Returns the signature for the request. -
setSignature
Sets the signature for the request. -
signature
Builder pattern method to returnOAuth1Parameters
after setting signature.- Parameters:
signature
- the signature for the request.- Returns:
- this parameters object.
-
getTimestamp
Returns the timestamp, a value expected to be a positive integer, typically containing the number of seconds since January 1, 1970 00:00:00 GMT (epoch). -
setTimestamp
Sets the timestamp. Its value is not validated, but should be a positive integer, typically containing the number of seconds since January 1, 1970 00:00:00 GMT (epoch). -
timestamp
Builder pattern method to returnOAuth1Parameters
after setting timestamp.- Parameters:
timestamp
- positive integer, typically number of seconds since epoch.- Returns:
- this parameters object.
-
setTimestamp
public void setTimestamp()Sets the timestamp to the current time as number of seconds since epoch. -
timestamp
Builder pattern method to returnOAuth1Parameters
after setting timestamp to the current time.- Returns:
- this parameters object.
-
getNonce
Returns the nonce, a value that should be unique for a given timestamp. -
setNonce
Sets the nonce, a value that should be unique for a given timestamp. -
nonce
Builder pattern method to returnOAuth1Parameters
after setting nonce.- Parameters:
nonce
- a value that should be unique for a given timestamp.- Returns:
- this parameters object.
-
setNonce
public void setNonce()Sets the nonce to contain a randomly-generated UUID. -
nonce
Builder pattern method to returnOAuth1Parameters
after setting nonce to a randomly-generated UUID.- Returns:
- this parameters object.
-
getVersion
Returns the protocol version. -
setVersion
Sets the protocol version. -
version
Builder pattern method to returnOAuth1Parameters
after setting version.- Parameters:
version
- the protocol version.- Returns:
- this parameters object.
-
setVersion
public void setVersion()Sets the protocol version to the default value of 1.0. -
version
Builder pattern method to returnOAuth1Parameters
after setting version to the default value of 1.0.- Returns:
- this parameters object.
-
getVerifier
Returns the verifier code. -
setVerifier
Sets the verifier code. -
verifier
Builder pattern method to returnOAuth1Parameters
after setting verifier code.- Parameters:
verifier
- the verifier code.- Returns:
- this parameters object.
-
getCallback
Returns the callback URL. -
setCallback
Sets the callback URL. -
callback
Builder pattern method to returnOAuth1Parameters
after setting callback URL.- Parameters:
callback
- the callback URL.- Returns:
- this parameters object.
-
readRequest
Reads a request for OAuth parameters, and populates this object.- Parameters:
request
- the request to read OAuth parameters from.- Returns:
- this parameters object.
-
writeRequest
Writes the OAuth parameters to a request, as an Authorization header.- Parameters:
request
- the request to write OAuth parameters to.- Returns:
- this parameters object.
-
clone
-