Class 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
AuthorizationCodeTokenRequest to request the access token.
Sample usage for a web application:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String url =
new AuthorizationCodeRequestUrl("https://server.example.com/authorize", "s6BhdRkqt3")
.setState("xyz").setRedirectUri("https://client.example.com/rd").build();
response.sendRedirect(url);
}
Implementation is not thread-safe.
- Since:
- 1.7
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.FlagsNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionAuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId) -
Method Summary
Modifier and TypeMethodDescriptionclone()setClientId(String clientId) Sets the client identifier.setRedirectUri(String redirectUri) Sets the URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant (as specified in Redirection Endpoint) ornullfor none.setResponseTypes(Collection<String> responseTypes) Sets the response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or a list of registered extension values to join with a space.setScopes(Collection<String> scopes) Sets the list of scopes (as specified in Access Token Scope) ornullfor none.Sets the state (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.Methods inherited from class com.google.api.client.auth.oauth2.AuthorizationRequestUrl
getClientId, getRedirectUri, getResponseTypes, getScopes, getStateMethods inherited from class com.google.api.client.http.GenericUrl
appendRawPath, build, buildAuthority, buildRelativeUrl, equals, getAll, getFirst, getFragment, getHost, getPathParts, getPort, getRawPath, getScheme, getUserInfo, hashCode, setFragment, setHost, setPathParts, setPort, setRawPath, setScheme, setUserInfo, toPathParts, toString, toURI, toURL, toURLMethods inherited from class com.google.api.client.util.GenericData
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeysMethods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
AuthorizationCodeRequestUrl
- Parameters:
authorizationServerEncodedUrl- authorization server encoded URLclientId- client identifier
-
-
Method Details
-
setResponseTypes
Description copied from class:AuthorizationRequestUrlSets the response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or a list of registered extension values to join with a space.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setResponseTypesin classAuthorizationRequestUrl
-
setRedirectUri
Description copied from class:AuthorizationRequestUrlSets the URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant (as specified in Redirection Endpoint) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setRedirectUriin classAuthorizationRequestUrl
-
setScopes
Description copied from class:AuthorizationRequestUrlSets the list of scopes (as specified in Access Token Scope) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setScopesin classAuthorizationRequestUrl- Parameters:
scopes- collection of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes) ornullfor none
-
setClientId
Description copied from class:AuthorizationRequestUrlSets the client identifier.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setClientIdin classAuthorizationRequestUrl
-
setState
Description copied from class:AuthorizationRequestUrlSets the state (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setStatein classAuthorizationRequestUrl
-
set
- Overrides:
setin classAuthorizationRequestUrl
-
clone
- Overrides:
clonein classAuthorizationRequestUrl
-