Class AuthorizationRequestUrl (1.33.3)

public class AuthorizationRequestUrl extends GenericUrl

OAuth 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.

Inheritance

Object > java.util.AbstractMap > com.google.api.client.util.GenericData > com.google.api.client.http.GenericUrl > AuthorizationRequestUrl

Constructors

AuthorizationRequestUrl(String authorizationServerEncodedUrl, String clientId, Collection<String> responseTypes)

public AuthorizationRequestUrl(String authorizationServerEncodedUrl, String clientId, Collection<String> responseTypes)
Parameters
NameDescription
authorizationServerEncodedUrlString

authorization server encoded URL

clientIdString

client identifier

responseTypesCollection<String>

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

Methods

clone()

public AuthorizationRequestUrl clone()
Returns
TypeDescription
AuthorizationRequestUrl
Overrides
com.google.api.client.http.GenericUrl.clone()

getClientId()

public final String getClientId()

Returns the client identifier.

Returns
TypeDescription
String

getRedirectUri()

public final 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) or null for none.

Returns
TypeDescription
String

getResponseTypes()

public final 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.

Returns
TypeDescription
String

getScopes()

public final String getScopes()

Returns the space-separated list of scopes (as specified in Access Token Scope) or null for none.

Returns
TypeDescription
String

getState()

public final 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) or null for none.

Returns
TypeDescription
String

set(String fieldName, Object value)

public AuthorizationRequestUrl set(String fieldName, Object value)
Parameters
NameDescription
fieldNameString
valueObject
Returns
TypeDescription
AuthorizationRequestUrl
Overrides
com.google.api.client.http.GenericUrl.set(java.lang.String,java.lang.Object)

setClientId(String clientId)

public AuthorizationRequestUrl setClientId(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.

Parameter
NameDescription
clientIdString
Returns
TypeDescription
AuthorizationRequestUrl

setRedirectUri(String redirectUri)

public AuthorizationRequestUrl 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) or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
redirectUriString
Returns
TypeDescription
AuthorizationRequestUrl

setResponseTypes(Collection<String> responseTypes)

public AuthorizationRequestUrl 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.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
responseTypesCollection<String>
Returns
TypeDescription
AuthorizationRequestUrl

setScopes(Collection<String> scopes)

public AuthorizationRequestUrl setScopes(Collection<String> scopes)

Sets the list of scopes (as specified in Access Token Scope) or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
scopesCollection<String>

collection of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes) or null for none

Returns
TypeDescription
AuthorizationRequestUrl

setState(String state)

public AuthorizationRequestUrl setState(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) or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
stateString
Returns
TypeDescription
AuthorizationRequestUrl