Class AuthorizationCodeResponseUrl
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,java.lang.Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.http.GenericUrl
-
- com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl
-
- All Implemented Interfaces:
java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
public class AuthorizationCodeResponseUrl extends com.google.api.client.http.GenericUrlOAuth 2.0 URL parser for the redirect URL after end user grants or denies authorization as specified in Authorization Response.Check if
getError()isnullto 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
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcodeAuthorization code generated by the authorization server ornullfor none.private java.lang.StringerrorError 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) ornullfor none.private java.lang.StringerrorDescriptionHuman-readable text providing additional information used to assist the client developer in understanding the error that occurred ornullfor none.private java.lang.StringerrorUriURI identifying a human-readable web page with information about the error used to provide the client developer with additional information about the error ornullfor none.private java.lang.StringstateState parameter matching the state parameter in the authorization request ornullfor none.
-
Constructor Summary
Constructors Constructor Description AuthorizationCodeResponseUrl(java.lang.String encodedResponseUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthorizationCodeResponseUrlclone()java.lang.StringgetCode()Returns the authorization code generated by the authorization server ornullfor none.java.lang.StringgetError()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) ornullfor none.java.lang.StringgetErrorDescription()Returns the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornullfor none.java.lang.StringgetErrorUri()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 ornullfor none.java.lang.StringgetState()Returns the state parameter matching the state parameter in the authorization request ornullfor none.AuthorizationCodeResponseUrlset(java.lang.String fieldName, java.lang.Object value)AuthorizationCodeResponseUrlsetCode(java.lang.String code)Sets the authorization code generated by the authorization server ornullfor none.AuthorizationCodeResponseUrlsetError(java.lang.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) ornullfor none.AuthorizationCodeResponseUrlsetErrorDescription(java.lang.String errorDescription)Sets the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornullfor none.AuthorizationCodeResponseUrlsetErrorUri(java.lang.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 ornullfor none.AuthorizationCodeResponseUrlsetState(java.lang.String state)Sets the state parameter matching the state parameter in the authorization request ornullfor 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
-
-
-
-
Field Detail
-
code
private java.lang.String code
Authorization code generated by the authorization server ornullfor none.
-
state
private java.lang.String state
State parameter matching the state parameter in the authorization request ornullfor none.
-
error
private java.lang.String 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) ornullfor none.
-
errorDescription
private java.lang.String errorDescription
Human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornullfor none.
-
errorUri
private java.lang.String 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 ornullfor none.
-
-
Method Detail
-
getCode
public final java.lang.String getCode()
Returns the authorization code generated by the authorization server ornullfor none.
-
setCode
public AuthorizationCodeResponseUrl setCode(java.lang.String code)
Sets the authorization code generated by the authorization server ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getState
public final java.lang.String getState()
Returns the state parameter matching the state parameter in the authorization request ornullfor none.
-
setState
public AuthorizationCodeResponseUrl setState(java.lang.String state)
Sets the state parameter matching the state parameter in the authorization request ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getError
public final java.lang.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) ornullfor none.
-
setError
public AuthorizationCodeResponseUrl setError(java.lang.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) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getErrorDescription
public final java.lang.String getErrorDescription()
Returns the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornullfor none.
-
setErrorDescription
public AuthorizationCodeResponseUrl setErrorDescription(java.lang.String errorDescription)
Sets the human-readable text providing additional information used to assist the client developer in understanding the error that occurred ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getErrorUri
public final java.lang.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 ornullfor none.
-
setErrorUri
public AuthorizationCodeResponseUrl setErrorUri(java.lang.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 ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
set
public AuthorizationCodeResponseUrl set(java.lang.String fieldName, java.lang.Object value)
- Overrides:
setin classcom.google.api.client.http.GenericUrl
-
clone
public AuthorizationCodeResponseUrl clone()
- Overrides:
clonein classcom.google.api.client.http.GenericUrl
-
-