Package play.libs
Class OAuth2
- java.lang.Object
-
- play.libs.OAuth2
-
public class OAuth2 extends java.lang.ObjectLibrary to access resources protected by OAuth 2.0. For OAuth 1.0a, see play.libs.OAuth. See the facebook-oauth2 example for usage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOAuth2.Errorstatic classOAuth2.Response
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringaccessTokenURLjava.lang.StringauthorizationURLjava.lang.Stringclientidjava.lang.Stringsecret
-
Constructor Summary
Constructors Constructor Description OAuth2(java.lang.String authorizationURL, java.lang.String accessTokenURL, java.lang.String clientid, java.lang.String secret)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetAccessToken()Deprecated.Use @{link play.libs.OAuth2.retrieveAccessToken()} insteadstatic booleanisCodeResponse()voidrequestAccessToken()Deprecated.Use @{link play.libs.OAuth2.retrieveVerificationCode()} insteadOAuth2.ResponseretrieveAccessToken()OAuth2.ResponseretrieveAccessToken(java.lang.String callbackURL)voidretrieveVerificationCode()voidretrieveVerificationCode(java.lang.String callbackURL)First step of the OAuth2 process: redirects the user to the authorisation pagevoidretrieveVerificationCode(java.lang.String callbackURL, java.lang.String parameterName, java.lang.String parameterValue)First step of the oAuth2 process.voidretrieveVerificationCode(java.lang.String callbackURL, java.util.Map<java.lang.String,java.lang.String> parameters)First step of the oAuth2 process.
-
-
-
Method Detail
-
isCodeResponse
public static boolean isCodeResponse()
-
retrieveVerificationCode
public void retrieveVerificationCode(java.lang.String callbackURL)
First step of the OAuth2 process: redirects the user to the authorisation page- Parameters:
callbackURL- The callback URL
-
retrieveVerificationCode
public void retrieveVerificationCode(java.lang.String callbackURL, java.lang.String parameterName, java.lang.String parameterValue)First step of the oAuth2 process. This redirects the user to the authorization page on the oAuth2 provider. This is a helper method that only takes one parameter name,value pair and then converts them into a map to be used byretrieveVerificationCode(String, Map)- Parameters:
callbackURL- The URL to redirect the user to after authorizationparameterName- An additional parameter nameparameterValue- An additional parameter value
-
retrieveVerificationCode
public void retrieveVerificationCode(java.lang.String callbackURL, java.util.Map<java.lang.String,java.lang.String> parameters)First step of the oAuth2 process. This redirects the user to the authorisation page on the oAuth2 provider.- Parameters:
callbackURL- The URL to redirect the user to after authorisationparameters- Any additional parameters that weren't included in the constructor. For example you might need to add a response_type.
-
retrieveVerificationCode
public void retrieveVerificationCode()
-
retrieveAccessToken
public OAuth2.Response retrieveAccessToken(java.lang.String callbackURL)
-
retrieveAccessToken
public OAuth2.Response retrieveAccessToken()
-
requestAccessToken
@Deprecated public void requestAccessToken()
Deprecated.Use @{link play.libs.OAuth2.retrieveVerificationCode()} instead
-
getAccessToken
@Deprecated public java.lang.String getAccessToken()
Deprecated.Use @{link play.libs.OAuth2.retrieveAccessToken()} instead- Returns:
- The access token
-
-