Class Consumer
- java.lang.Object
-
- com.atlassian.bitbucket.jenkins.internal.applink.oauth.serviceprovider.consumer.Consumer
-
@Immutable public final class Consumer extends Object
Immutable representation of an OAuth consumer. At a minimum 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 exampleConsumer c = Consumer.key("consumer-key").name("Consumer").publicKey(publicRSAKey).build();
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Consumer.Builder
Builder allowing the optional attributes of theConsumer
object under construction to be set and construction of the finalConsumer
instance.static class
Consumer.SignatureMethod
The ways in which consumers can sign requests, as per
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<URI>
getCallback()
Returns the default callbackURI
used after a request token has been authorized if no callbackURI
was provided in the authorization request.Optional<String>
getConsumerSecret()
Returns optional secret for the consumer, If the signature method is HMAC_SHA1, this secret is used in verifying the signature in requests from the consumer.Optional<String>
getDescription()
Returns the optional description of the consumer as it would be displayed to the user, empty if the description was not set.String
getKey()
Returns the unique key used to identify the consumer in requests unauthorized OAuth request tokens.String
getName()
Returns the name of the consumer as it will be displayed to the user.Optional<PublicKey>
getPublicKey()
Returns optional RSA public key for the consumer, If the signature method is RSA-SHA1, this key is used in verifying the signature in requests from the consumer.Consumer.SignatureMethod
getSignatureMethod()
Returns the method the consumer uses to sign requests.static Consumer.Builder
key(String key)
Static factory method that starts the process of building aConsumer
instance.String
toString()
-
-
-
Method Detail
-
key
public static Consumer.Builder key(String key)
Static factory method that starts the process of building aConsumer
instance. Returns anBuilder
so 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
Consumer
instance
-
getKey
public String getKey()
Returns the unique key used to identify the consumer in requests unauthorized OAuth request tokens.- Returns:
- the unique key
-
getName
public String getName()
Returns the name of the consumer as it will be displayed to the user.- Returns:
- the name
-
getSignatureMethod
public Consumer.SignatureMethod getSignatureMethod()
Returns the method the consumer uses to sign requests.- Returns:
- the signature method
-
getPublicKey
public Optional<PublicKey> getPublicKey()
Returns optional RSA public key for the consumer, 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
-
getDescription
public Optional<String> getDescription()
Returns the optional description of the consumer as it would be displayed to the user, empty if the description was not set.- Returns:
- the optional description of the consumer as it would be displayed to the user, or
empty
if the description was not set
-
getCallback
public Optional<URI> getCallback()
Returns the default callbackURI
used after a request token has been authorized if no callbackURI
was provided in the authorization request.- Returns:
- the default callback
URI
used after a request token has been authorized if one is provided,empty
otherwise
-
getConsumerSecret
public Optional<String> getConsumerSecret()
Returns optional secret for the consumer, If the signature method is HMAC_SHA1, this secret is used in verifying the signature in requests from the consumer.- Returns:
- the secret
-
-