public class OAuth10aServiceImpl extends java.lang.Object implements OAuthService
OAuthService
Constructor and Description |
---|
OAuth10aServiceImpl(DefaultOAuthApi10a api,
OAuthConfig config)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
Token |
getAccessToken(Token requestToken,
Verifier verifier)
Retrieve the access token
|
java.lang.String |
getAuthorizationUrl(Token requestToken)
Returns the URL where you should redirect your users to authenticate your application.
|
Token |
getRequestToken()
Retrieve the request token.
|
java.lang.String |
getVersion()
Returns the OAuth version of the service.
|
Token |
refreshAccessToken(Token refreshOrAccessToken,
boolean includeSecret)
Refresh the access token to extend its expiration date.
|
void |
signRequest(Token token,
OAuthRequest request)
Signs am OAuth request
|
public OAuth10aServiceImpl(DefaultOAuthApi10a api, OAuthConfig config)
api
- OAuth1.0a api informationconfig
- OAuth 1.0a configuration param objectpublic Token getRequestToken()
getRequestToken
in interface OAuthService
public Token getAccessToken(@Nullable Token requestToken, Verifier verifier)
getAccessToken
in interface OAuthService
requestToken
- request token (obtained previously; not required for OAuth 2)verifier
- verifier codepublic Token refreshAccessToken(Token refreshOrAccessToken, boolean includeSecret)
Token.getRawResponse()
returned by OAuthService.getAccessToken(jsimple.oauth.model.Token, jsimple.oauth.model.Verifier)
)
As for the client secret, for some providers in some scenarios it's not required. In particular, for Live
Connect (taken from http://msdn.microsoft.com/en-us/library/live/hh243647.aspx): "Because apps must also refresh
access tokens, the Live Connect app management site allows apps to be marked as mobile client apps. When this
marker is specified and the special redirect URL (https://login.live.com/oauth20_desktop.srf) is used, the client
secret is not required to refresh the access token.".refreshAccessToken
in interface OAuthService
refreshOrAccessToken
- access or refresh token, depending on the OAuth providerincludeSecret
- whether or not to include the client secret; Windows Live, for mobile apps, doesn't
require itpublic void signRequest(Token token, OAuthRequest request)
signRequest
in interface OAuthService
token
- access token (obtained previously)request
- request to signpublic java.lang.String getVersion()
getVersion
in interface OAuthService
public java.lang.String getAuthorizationUrl(@Nullable Token requestToken)
getAuthorizationUrl
in interface OAuthService
requestToken
- the request token you need to authorize; not used for OAuth2