public class OAuth1NoCallback extends OAuth1Generic
begin()
to obtain a temporary token and a redirect URL if OAuth1Generic.authoriseUrl
was provided (not null).
authorised(String)
with the temporary token obtained in (1).
OAuthParameters
object that can be used to make requests on the user's behalf. Using the OAuthParameters
make a request to a given URL with a given HTTP request method and body via OAuth1Generic.makeOAuthBackedRequest(String, OAuthParameters, RequestMethod, HttpContent)
.accessTokenUrl, authoriseUrl, callbackUrl, consumerKey, consumerSecret, requestTokenUrl, tokenMapStrategy
Constructor and Description |
---|
OAuth1NoCallback(String consumerKey,
String consumerSecret,
String requestTokenUrl,
String authoriseUrl,
String accessTokenUrl,
TokenMapStrategy tokenMapStrategy) |
Modifier and Type | Method and Description |
---|---|
AuthorisedResult |
authorised(String temporaryToken)
Fetches the token secret corresponding to the temporary token,
then uses the obtained token secret along with the original temporary token to obtain an access token from the server.
|
BeginResult |
begin()
Requests a temporary token and corresponding token secret from the server,
then maps the temporary token to the token secret
and returns the obtained temporary token along with the authenticate URL (redirect URL) if
OAuth1Generic.authoriseUrl is non-null. |
authorised, makeOAuthBackedRequest
public OAuth1NoCallback(@Nonnull String consumerKey, @Nonnull String consumerSecret, @Nonnull String requestTokenUrl, @Nullable String authoriseUrl, @Nonnull String accessTokenUrl, @Nonnull TokenMapStrategy tokenMapStrategy)
consumerKey
- Required identifier portion of the client credentials (equivalent to a username). More information: client_id entry of the OAuthParameters table at https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtmlconsumerSecret
- Client-shared secret. More information: client_id entry of the OAuthParameters table at https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtmlrequestTokenUrl
- Encoded authorization server URL. More information: request_uri entry of the OAuthParameters table at https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtmlauthoriseUrl
- Encoded user authorization URL, or null if only wish to receive the temporary token and build it themselves.accessTokenUrl
- Encoded authorization server URL.tokenMapStrategy
- Strategy to map temporary tokens to token secrets, and fetch the token secret for a temporary token.@Nonnull public BeginResult begin() throws GetTemporaryTokenException, TokenMapException
OAuth1Generic.authoriseUrl
is non-null.begin
in class OAuth1Generic
OAuth1Generic.authoriseUrl
is non-null, otherwise null.GetTemporaryTokenException
- If the request to the server for the temporary token failed.TokenMapException
- If mapping the obtained temporary token to the obtained token secret failed.@Nonnull public AuthorisedResult authorised(@Nonnull String temporaryToken) throws GetAccessTokenException, TokenMapException
temporaryToken
- The temporary token obtained from begin()
OAuthParameters
object used to make OAuth-backed requests on behalf of the access token via OAuth1Generic.makeOAuthBackedRequest(String, OAuthParameters, RequestMethod, HttpContent)
GetAccessTokenException
- If the request to the server for the access token failed.TokenMapException
- If fetching the token secret corresponding to the given temporary token failed.Copyright © 2020. All rights reserved.