public class AuthorizationCodeResponseUrl extends GenericUrl
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.
GenericData.Flags
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
AuthorizationCodeResponseUrl(String encodedResponseUrl) |
Modifier and Type | Method and Description |
---|---|
AuthorizationCodeResponseUrl |
clone() |
String |
getCode()
Returns the authorization code generated by the authorization server or
null for none. |
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)
or null for none. |
String |
getErrorDescription()
Returns the human-readable text providing additional information used to assist the client
developer in understanding the error that occurred or
null for none. |
String |
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 or
null for
none. |
String |
getState()
Returns the state parameter matching the state parameter in the authorization request or
null for none. |
AuthorizationCodeResponseUrl |
set(String fieldName,
Object value) |
AuthorizationCodeResponseUrl |
setCode(String code)
Sets the authorization code generated by the authorization server or
null for none. |
AuthorizationCodeResponseUrl |
setError(String error)
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)
or null for none. |
AuthorizationCodeResponseUrl |
setErrorDescription(String errorDescription)
Sets the human-readable text providing additional information used to assist the client
developer in understanding the error that occurred or
null for none. |
AuthorizationCodeResponseUrl |
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 or
null for
none. |
AuthorizationCodeResponseUrl |
setState(String state)
Sets the state parameter matching the state parameter in the authorization request or
null for none. |
appendRawPath, 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, toURL
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
clear, containsKey, containsValue, isEmpty, keySet, size, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public AuthorizationCodeResponseUrl(String encodedResponseUrl)
encodedResponseUrl
- encoded authorization code response URLpublic final String getCode()
null
for none.public AuthorizationCodeResponseUrl setCode(String code)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getState()
null
for none.public AuthorizationCodeResponseUrl setState(String state)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getError()
"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)
or null
for none.public AuthorizationCodeResponseUrl setError(String error)
"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)
or null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getErrorDescription()
null
for none.public AuthorizationCodeResponseUrl setErrorDescription(String errorDescription)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getErrorUri()
null
for
none.public AuthorizationCodeResponseUrl setErrorUri(String errorUri)
null
for
none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public AuthorizationCodeResponseUrl set(String fieldName, Object value)
set
in class GenericUrl
public AuthorizationCodeResponseUrl clone()
clone
in class GenericUrl
Copyright © 2011–2022 Google. All rights reserved.