Class AuthorizationCodeResponseUrl
Check if getError()
is null
to check if the end-user granted authorization.
Sample usage:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { StringBuffer fullUrlBuf = request.getRequestURL(); if (request.getQueryString() != null) { fullUrlBuf.append('?').append(request.getQueryString()); } AuthorizationCodeResponseUrl authResponse = new AuthorizationCodeResponseUrl(fullUrlBuf.toString()); // check for user-denied error if (authResponse.getError() != null) { // authorization denied... } else { // request access token using authResponse.getCode()... } }
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.Flags
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
Authorization code generated by the authorization server ornull
for none.private String
Error code ("invalid_request"
,"unauthorized_client"
,"access_denied"
,"unsupported_response_type"
,"invalid_scope"
,"server_error"
,"temporarily_unavailable"
, or an extension error code as specified in Defining Additional Error Codes) ornull
for none.private String
Human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornull
for none.private String
URI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornull
for none.private String
State parameter matching the state parameter in the authorization request ornull
for none. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
final String
getCode()
Returns the authorization code generated by the authorization server ornull
for none.final String
getError()
Returns the error code ("invalid_request"
,"unauthorized_client"
,"access_denied"
,"unsupported_response_type"
,"invalid_scope"
,"server_error"
,"temporarily_unavailable"
, or an extension error code as specified in Defining Additional Error Codes) ornull
for none.final String
Returns the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornull
for none.final String
Returns the URI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornull
for none.final String
getState()
Returns the state parameter matching the state parameter in the authorization request ornull
for none.Sets the authorization code generated by the authorization server ornull
for none.Sets the error code ("invalid_request"
,"unauthorized_client"
,"access_denied"
,"unsupported_response_type"
,"invalid_scope"
,"server_error"
,"temporarily_unavailable"
, or an extension error code as specified in Defining Additional Error Codes) ornull
for none.setErrorDescription
(String errorDescription) Sets the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornull
for none.setErrorUri
(String errorUri) Sets the URI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornull
for none.Sets the state parameter matching the state parameter in the authorization request ornull
for none.Methods 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, toURL
Methods inherited from class com.google.api.client.util.GenericData
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
code
Authorization code generated by the authorization server ornull
for none. -
state
State parameter matching the state parameter in the authorization request ornull
for none. -
error
Error code ("invalid_request"
,"unauthorized_client"
,"access_denied"
,"unsupported_response_type"
,"invalid_scope"
,"server_error"
,"temporarily_unavailable"
, or an extension error code as specified in Defining Additional Error Codes) ornull
for none. -
errorDescription
Human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornull
for none. -
errorUri
URI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornull
for none.
-
-
Constructor Details
-
AuthorizationCodeResponseUrl
- Parameters:
encodedResponseUrl
- encoded authorization code response URL
-
-
Method Details
-
getCode
Returns the authorization code generated by the authorization server ornull
for none. -
setCode
Sets the authorization code generated by the authorization server ornull
for none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getState
Returns the state parameter matching the state parameter in the authorization request ornull
for none. -
setState
Sets the state parameter matching the state parameter in the authorization request ornull
for none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getError
Returns the error code ("invalid_request"
,"unauthorized_client"
,"access_denied"
,"unsupported_response_type"
,"invalid_scope"
,"server_error"
,"temporarily_unavailable"
, or an extension error code as specified in Defining Additional Error Codes) ornull
for none. -
setError
Sets the error code ("invalid_request"
,"unauthorized_client"
,"access_denied"
,"unsupported_response_type"
,"invalid_scope"
,"server_error"
,"temporarily_unavailable"
, or an extension error code as specified in Defining Additional Error Codes) ornull
for none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getErrorDescription
Returns the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornull
for none. -
setErrorDescription
Sets the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornull
for none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getErrorUri
Returns the URI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornull
for none. -
setErrorUri
Sets the URI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornull
for none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
set
- Overrides:
set
in classcom.google.api.client.http.GenericUrl
-
clone
- Overrides:
clone
in classcom.google.api.client.http.GenericUrl
-