public class Google2Client extends BaseOAuth20StateClient<Google2Profile>
This class is the OAuth client to authenticate users in Google using OAuth protocol version 2.0.
The scope is by default : Google2Client.Google2Scope.EMAIL_AND_PROFILE, but it can also but set to : Google2Client.Google2Scope.PROFILE
or Google2Client.Google2Scope.EMAIL.
It returns a Google2Profile.
More information at https://developers.google.com/accounts/docs/OAuth2Login
Google2Profile| Modifier and Type | Class and Description |
|---|---|
static class |
Google2Client.Google2Scope |
| Modifier and Type | Field and Description |
|---|---|
protected String |
EMAIL_SCOPE |
protected String |
PROFILE_SCOPE |
protected Google2Client.Google2Scope |
scope |
protected String |
scopeValue |
logger, OAUTH_CODEconnectTimeout, key, proxyHost, proxyPort, readTimeout, secret, service, tokenAsHeaderATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, callbackUrlResolver, NEEDS_CLIENT_REDIRECTION_PARAMETER| Constructor and Description |
|---|
Google2Client() |
Google2Client(String key,
String secret) |
| Modifier and Type | Method and Description |
|---|---|
protected Google2Profile |
extractUserProfile(String body)
Extract the user profile from the response (JSON, XML...) of the profile url.
|
protected String |
getProfileUrl(org.scribe.model.Token accessToken)
Retrieve the url of the profile of the authenticated user for the provider.
|
Google2Client.Google2Scope |
getScope() |
protected boolean |
hasBeenCancelled(WebContext context)
Return if the authentication has been cancelled.
|
protected void |
internalInit(WebContext context) |
protected Google2Client |
newClient() |
protected String |
retrieveAuthorizationUrl(WebContext context) |
void |
setScope(Google2Client.Google2Scope scope) |
void |
setUseStateParameter(boolean requiresStateParameter)
Enable or disable usage of the 'state' parameter as a CSRF protection in OAuth.
|
getAuthorizationUrl, getOAuthCredentials, getState, setStategetAccessToken, isDirectRedirectionaddAccessTokenToProfile, clone, createProxyRequest, getClientType, getConnectTimeout, getKey, getProxyHost, getProxyPort, getReadTimeout, getSecret, getUserProfile, isTokenAsHeader, retrieveCredentials, retrieveRedirectAction, retrieveUserProfile, retrieveUserProfileFromToken, sendRequestForData, sendRequestForData, setConnectTimeout, setKey, setProxyHost, setProxyPort, setReadTimeout, setSecret, setTokenAsHeadercomputeFinalCallbackUrl, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getRedirectAction, getRedirectionUrl, getStateParameter, isIncludeClientNameInCallbackUrl, redirect, setAjaxRequestResolver, setCallbackUrl, setCallbackUrlResolver, setIncludeClientNameInCallbackUrladdAuthorizationGenerator, getAuthorizationGenerators, getName, getUserProfile, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setName, toStringinit, reinitprotected final String PROFILE_SCOPE
protected final String EMAIL_SCOPE
protected Google2Client.Google2Scope scope
protected String scopeValue
protected Google2Client newClient()
newClient in class BaseClientprotected void internalInit(WebContext context)
internalInit in class BaseOAuthClientprotected String getProfileUrl(org.scribe.model.Token accessToken)
BaseOAuthClientgetProfileUrl in class BaseOAuthClientaccessToken - only used when constructing dynamic urls from data in the tokenprotected Google2Profile extractUserProfile(String body)
BaseOAuthClientextractUserProfile in class BaseOAuthClientbody - the response bodypublic Google2Client.Google2Scope getScope()
public void setScope(Google2Client.Google2Scope scope)
protected boolean hasBeenCancelled(WebContext context)
BaseOAuthClienthasBeenCancelled in class BaseOAuthClientcontext - the web context.public void setUseStateParameter(boolean requiresStateParameter)
requiresStateParameter - whether the 'state' parameter must be usedprotected String retrieveAuthorizationUrl(WebContext context)
retrieveAuthorizationUrl in class BaseOAuth20StateClient<Google2Profile>Copyright © 2016. All Rights Reserved.