public class GoogleAuthorizationCodeRequestUrl extends AuthorizationCodeRequestUrl
The default for AuthorizationRequestUrl.getResponseTypes() is "code". Use
AuthorizationCodeResponseUrl to parse the redirect response after the end user
grants/denies the request. Using the authorization code in this response, use
GoogleAuthorizationCodeTokenRequest to request the access token.
Sample usage for a web application:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String url =
new GoogleAuthorizationCodeRequestUrl("812741506391.apps.googleusercontent.com",
"https://oauth2-login-demo.appspot.com/code", Arrays.asList(
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build();
response.sendRedirect(url);
}
Implementation is not thread-safe.
GenericData.FlagsAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
GoogleAuthorizationCodeRequestUrl(GoogleClientSecrets clientSecrets,
String redirectUri,
Collection<String> scopes) |
GoogleAuthorizationCodeRequestUrl(String clientId,
String redirectUri,
Collection<String> scopes) |
GoogleAuthorizationCodeRequestUrl(String authorizationServerEncodedUrl,
String clientId,
String redirectUri,
Collection<String> scopes) |
| Modifier and Type | Method and Description |
|---|---|
GoogleAuthorizationCodeRequestUrl |
clone() |
String |
getAccessType()
Returns the access type (
"online" to request online access or "offline" to
request offline access) or null for the default behavior of "online". |
String |
getApprovalPrompt()
Returns the approval prompt behavior (
"auto" to request auto-approval or
"force" to force the approval UI to show) or null for the default behavior of
"auto". |
GoogleAuthorizationCodeRequestUrl |
set(String fieldName,
Object value) |
GoogleAuthorizationCodeRequestUrl |
setAccessType(String accessType)
Sets the access type (
"online" to request online access or "offline" to request
offline access) or null for the default behavior of "online". |
GoogleAuthorizationCodeRequestUrl |
setApprovalPrompt(String approvalPrompt)
Sets the approval prompt behavior (
"auto" to request auto-approval or "force"
to force the approval UI to show) or null for the default behavior of "auto". |
GoogleAuthorizationCodeRequestUrl |
setClientId(String clientId) |
GoogleAuthorizationCodeRequestUrl |
setRedirectUri(String redirectUri) |
GoogleAuthorizationCodeRequestUrl |
setResponseTypes(Collection<String> responseTypes) |
GoogleAuthorizationCodeRequestUrl |
setScopes(Collection<String> scopes) |
GoogleAuthorizationCodeRequestUrl |
setState(String state) |
getClientId, getRedirectUri, getResponseTypes, getScopes, getStateappendRawPath, build, buildAuthority, buildRelativeUrl, equals, getAll, getFirst, getFragment, getHost, getPathParts, getPort, getRawPath, getScheme, getUserInfo, hashCode, setFragment, setHost, setPathParts, setPort, setRawPath, setScheme, setUserInfo, toPathParts, toPathParts, toString, toURI, toURL, toURLentrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeysclear, containsKey, containsValue, isEmpty, keySet, size, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic GoogleAuthorizationCodeRequestUrl(String clientId, String redirectUri, Collection<String> scopes)
clientId - client identifierredirectUri - URI that the authorization server directs the resource owner's user-agent
back to the client after a successful authorization grantscopes - scopes (see setScopes(Collection))public GoogleAuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId, String redirectUri, Collection<String> scopes)
authorizationServerEncodedUrl - authorization server encoded URLclientId - client identifierredirectUri - URI that the authorization server directs the resource owner's user-agent
back to the client after a successful authorization grantscopes - scopes (see setScopes(Collection))public GoogleAuthorizationCodeRequestUrl(GoogleClientSecrets clientSecrets, String redirectUri, Collection<String> scopes)
clientSecrets - OAuth 2.0 client secrets JSON model as specified in
client_secrets.json file formatredirectUri - URI that the authorization server directs the resource owner's user-agent
back to the client after a successful authorization grantscopes - scopes (see setScopes(Collection))public final String getApprovalPrompt()
"auto" to request auto-approval or
"force" to force the approval UI to show) or null for the default behavior of
"auto".public GoogleAuthorizationCodeRequestUrl setApprovalPrompt(String approvalPrompt)
"auto" to request auto-approval or "force"
to force the approval UI to show) or null for the default behavior of "auto".
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getAccessType()
"online" to request online access or "offline" to
request offline access) or null for the default behavior of "online".public GoogleAuthorizationCodeRequestUrl setAccessType(String accessType)
"online" to request online access or "offline" to request
offline access) or null for the default behavior of "online".
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public GoogleAuthorizationCodeRequestUrl setResponseTypes(Collection<String> responseTypes)
setResponseTypes in class AuthorizationCodeRequestUrlpublic GoogleAuthorizationCodeRequestUrl setRedirectUri(String redirectUri)
setRedirectUri in class AuthorizationCodeRequestUrlpublic GoogleAuthorizationCodeRequestUrl setScopes(Collection<String> scopes)
setScopes in class AuthorizationCodeRequestUrlpublic GoogleAuthorizationCodeRequestUrl setClientId(String clientId)
setClientId in class AuthorizationCodeRequestUrlpublic GoogleAuthorizationCodeRequestUrl setState(String state)
setState in class AuthorizationCodeRequestUrlpublic GoogleAuthorizationCodeRequestUrl set(String fieldName, Object value)
set in class AuthorizationCodeRequestUrlpublic GoogleAuthorizationCodeRequestUrl clone()
clone in class AuthorizationCodeRequestUrlCopyright © 2010–2020 Google. All rights reserved.