public class OAuth20ServiceImpl extends java.lang.Object implements OAuthService
Constructor and Description |
---|
OAuth20ServiceImpl(DefaultOAuthApi20 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 accessToken,
OAuthRequest request)
Signs am OAuth request
|
public OAuth20ServiceImpl(DefaultOAuthApi20 api, OAuthConfig config)
api
- OAuth2.0 api informationconfig
- OAuth 2.0 configuration param objectpublic 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 Token getRequestToken()
getRequestToken
in interface OAuthService
public java.lang.String getVersion()
getVersion
in interface OAuthService
public void signRequest(Token accessToken, OAuthRequest request)
signRequest
in interface OAuthService
accessToken
- access token (obtained previously)request
- request to signpublic java.lang.String getAuthorizationUrl(@Nullable Token requestToken)
getAuthorizationUrl
in interface OAuthService
requestToken
- the request token you need to authorize; not used for OAuth2