Class AuthorizationRequestUrl
- 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.AuthorizationRequestUrl
-
- All Implemented Interfaces:
java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
- Direct Known Subclasses:
AuthorizationCodeRequestUrl,BrowserClientRequestUrl
public class AuthorizationRequestUrl extends com.google.api.client.http.GenericUrlOAuth 2.0 URL builder for an authorization web page to allow the end user to authorize the application to access their protected resources, as specified in Authorization Endpoint.Sample usage for a web application:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String url = new AuthorizationRequestUrl( "https://server.example.com/authorize", "s6BhdRkqt3", Arrays.asList("code")).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.Flags
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringclientIdClient identifier.private java.lang.StringredirectUriURI 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.private java.lang.StringresponseTypesResponse type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or space-separated registered extension values.private java.lang.StringscopesSpace-separated list of scopes (as specified in Access Token Scope) ornullfor none.private java.lang.StringstateState (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.
-
Constructor Summary
Constructors Constructor Description AuthorizationRequestUrl(java.lang.String authorizationServerEncodedUrl, java.lang.String clientId, java.util.Collection<java.lang.String> responseTypes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthorizationRequestUrlclone()java.lang.StringgetClientId()Returns the client identifier.java.lang.StringgetRedirectUri()Returns 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.java.lang.StringgetResponseTypes()Returns the Response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or space-separated registered extension values.java.lang.StringgetScopes()Returns the space-separated list of scopes (as specified in Access Token Scope) ornullfor none.java.lang.StringgetState()Returns the state (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.AuthorizationRequestUrlset(java.lang.String fieldName, java.lang.Object value)AuthorizationRequestUrlsetClientId(java.lang.String clientId)Sets the client identifier.AuthorizationRequestUrlsetRedirectUri(java.lang.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.AuthorizationRequestUrlsetResponseTypes(java.util.Collection<java.lang.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.AuthorizationRequestUrlsetScopes(java.util.Collection<java.lang.String> scopes)Sets the list of scopes (as specified in Access Token Scope) ornullfor none.AuthorizationRequestUrlsetState(java.lang.String state)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.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
-
responseTypes
private java.lang.String responseTypes
Response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or space-separated registered extension values.
-
redirectUri
private java.lang.String redirectUri
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.
-
scopes
private java.lang.String scopes
Space-separated list of scopes (as specified in Access Token Scope) ornullfor none.
-
clientId
private java.lang.String clientId
Client identifier.
-
state
private java.lang.String state
State (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.
-
-
Constructor Detail
-
AuthorizationRequestUrl
public AuthorizationRequestUrl(java.lang.String authorizationServerEncodedUrl, java.lang.String clientId, java.util.Collection<java.lang.String> responseTypes)- Parameters:
authorizationServerEncodedUrl- authorization server encoded URLclientId- client identifierresponseTypes- 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- Since:
- 1.15
-
-
Method Detail
-
getResponseTypes
public final java.lang.String getResponseTypes()
Returns the Response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or space-separated registered extension values.
-
setResponseTypes
public AuthorizationRequestUrl setResponseTypes(java.util.Collection<java.lang.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.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.15
-
getRedirectUri
public final java.lang.String getRedirectUri()
Returns 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.
-
setRedirectUri
public AuthorizationRequestUrl setRedirectUri(java.lang.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.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getScopes
public final java.lang.String getScopes()
Returns the space-separated list of scopes (as specified in Access Token Scope) ornullfor none.
-
setScopes
public AuthorizationRequestUrl setScopes(java.util.Collection<java.lang.String> scopes)
Sets 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.
- Parameters:
scopes- collection of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes) ornullfor none- Since:
- 1.15
-
getClientId
public final java.lang.String getClientId()
Returns the client identifier.
-
setClientId
public AuthorizationRequestUrl setClientId(java.lang.String clientId)
Sets the client identifier.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 (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.
-
setState
public AuthorizationRequestUrl setState(java.lang.String state)
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.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
set
public AuthorizationRequestUrl set(java.lang.String fieldName, java.lang.Object value)
- Overrides:
setin classcom.google.api.client.http.GenericUrl
-
clone
public AuthorizationRequestUrl clone()
- Overrides:
clonein classcom.google.api.client.http.GenericUrl
-
-