public class Google2Client extends BaseOAuth20Client<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, 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() |
protected Google2Client |
newClient() |
protected boolean |
requiresStateParameter()
Return if this client requires a state parameter.
|
void |
setScope(Google2Client.Google2Scope scope) |
getAccessToken, getOAuthCredentials, getStateParameter, isDirectRedirection, retrieveAuthorizationUrladdAccessTokenToProfile, clone, createProxyRequest, getConnectTimeout, getKey, getMechanism, getProxyHost, getProxyPort, getReadTimeout, getSecret, getUserProfile, isTokenAsHeader, retrieveCredentials, retrieveRedirectAction, retrieveUserProfile, retrieveUserProfileFromToken, sendRequestForData, sendRequestForData, setConnectTimeout, setKey, setProxyHost, setProxyPort, setReadTimeout, setSecret, setTokenAsHeaderaddAuthorizationGenerator, getAuthenticator, getAuthorizationGenerators, getCallbackUrl, getContextualCallbackUrl, getCredentials, getName, getProfileCreator, getRedirectAction, getRedirectionUrl, getUserProfile, isEnableContextualRedirects, prependHostToUrlIfNotPresent, redirect, setAuthenticator, setAuthorizationGenerator, setAuthorizationGenerators, setCallbackUrl, setEnableContextualRedirects, setName, setProfileCreator, toStringinit, reinitprotected final String PROFILE_SCOPE
protected final String EMAIL_SCOPE
protected Google2Client.Google2Scope scope
protected String scopeValue
protected Google2Client newClient()
newClient in class BaseClient<OAuthCredentials,Google2Profile>protected void internalInit()
internalInit in class BaseOAuthClient<Google2Profile>protected String getProfileUrl(org.scribe.model.Token accessToken)
BaseOAuthClientgetProfileUrl in class BaseOAuthClient<Google2Profile>accessToken - only used when constructing dynamic urls from data in the tokenprotected Google2Profile extractUserProfile(String body)
BaseOAuthClientextractUserProfile in class BaseOAuthClient<Google2Profile>body - the response bodypublic Google2Client.Google2Scope getScope()
public void setScope(Google2Client.Google2Scope scope)
protected boolean requiresStateParameter()
BaseOAuth20ClientrequiresStateParameter in class BaseOAuth20Client<Google2Profile>protected boolean hasBeenCancelled(WebContext context)
BaseOAuthClienthasBeenCancelled in class BaseOAuthClient<Google2Profile>context - the web context.Copyright © 2015. All Rights Reserved.