Package com.atlassian.oauth
Class Consumer
java.lang.Object
com.atlassian.oauth.Consumer
Immutable representation of an OAuth consumer. At a miminum a consumer is required to have a key, a name, and a public key. A consumer can also be configured to have a description and a default callback URL that will be used if a callback URL is not provided after a user authorizes a request token.
Instances of Consumer objects can be constructed using the builder. For example
Consumer c = Consumer.key("consumer-key").name("Consumer").publicKey(publicRSAKey).build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder allowing the optional attributes of theConsumerobject under construction to be set and construction of the finalConsumerinstance.static enumThe ways in which consumers can sign requests, as per -
Method Summary
Modifier and TypeMethodDescriptionReturns the default callbackURIused after a request token has been authorized if no callbackURIwas provided in the authorization request.Returns the optional description of the consumer as it would be displayed to the user,nullif the description was not set.Returns the user whose credential is used to execute 2LO requests.getKey()Returns the unique key used to identify the consumer in requests unauthorized OAuth request tokens.getName()Returns the name of the consumer as it will be displayed to the user.Returns the RSA public key for the consumer,nullif the signature method is not RSA-SHA1.Returns the method the consumer uses to sign requests.booleanReturns whether 3 Legged OAuth requests are allowed for this consumer.booleanReturns whether 2 Legged OAuth requests are allowed for this consumer.booleanReturns whether 2 Legged OAuth with impersonation requests are allowed for this consumer.static Consumer.InstanceBuilderStatic factory method that starts the process of building aConsumerinstance.toString()
-
Method Details
-
key
Static factory method that starts the process of building aConsumerinstance. Returns anInstanceBuilderso the other attribute can be set.- Parameters:
key- unique key used to identify the consumer in requests unauthorized OAuth request tokens- Returns:
- the builder for constructing the rest of the
Consumerinstance
-
getKey
Returns the unique key used to identify the consumer in requests unauthorized OAuth request tokens.- Returns:
- the unique key used to identify the consumer in requests unauthorized OAuth request tokens
-
getName
Returns the name of the consumer as it will be displayed to the user.- Returns:
- the name of the consumer as it will be displayed to the user
-
getSignatureMethod
Returns the method the consumer uses to sign requests.- Returns:
- the method the consumer uses to sign requests
-
getPublicKey
Returns the RSA public key for the consumer,nullif the signature method is not RSA-SHA1. If the signature method is RSA-SHA1, this key is used in verifying the signature in requests from the consumer.- Returns:
- the RSA public key for the consumer,
nullif the signature method is not RSA-SHA1
-
getDescription
Returns the optional description of the consumer as it would be displayed to the user,nullif the description was not set.- Returns:
- the optional description of the consumer as it would be displayed to the user,
nullif the description was not set.
-
getCallback
Returns the default callbackURIused after a request token has been authorized if no callbackURIwas provided in the authorization request.- Returns:
- the default callback
URIused after a request token has been authorized
-
getThreeLOAllowed
public boolean getThreeLOAllowed()Returns whether 3 Legged OAuth requests are allowed for this consumer.- Returns:
- whether 3 Legged OAuth requests are allowed for this consumer
-
getTwoLOAllowed
public boolean getTwoLOAllowed()Returns whether 2 Legged OAuth requests are allowed for this consumer.- Returns:
- whether 2 Legged OAuth requests are allowed for this consumer
-
getExecutingTwoLOUser
Returns the user whose credential is used to execute 2LO requests. This could be null only iftwoLOAllowedis false.- Returns:
- the user whose credential is used to execute 2LO requests
-
getTwoLOImpersonationAllowed
public boolean getTwoLOImpersonationAllowed()Returns whether 2 Legged OAuth with impersonation requests are allowed for this consumer.- Returns:
- whether 2 Legged OAuth with impersonation requests are allowed for this consumer
-
toString
-