public class AuthorizationCodeRequestUrl extends AuthorizationRequestUrl
OAuth 2.0 URL builder for an authorization web page to allow the end user to authorize the application to access their protected resources and that returns an authorization code, as specified in Authorization Code Grant.
The default for #getResponseTypes() is "code"
. Use AuthorizationCodeResponseUrl to parse the redirect response after the end user grants/denies the
request. Using the authorization code in this response, use AuthorizationCodeTokenRequest
to request the access token.
Sample usage for a web application:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String url = new AuthorizationCodeRequestUrl("https://server.example.com/authorize", "s6BhdRkqt3") .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 > AuthorizationCodeRequestUrlConstructors
AuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId)
public AuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId)
Name | Description |
authorizationServerEncodedUrl | String authorization server encoded URL |
clientId | String client identifier |
Methods
clone()
public AuthorizationCodeRequestUrl clone()
Type | Description |
AuthorizationCodeRequestUrl |
getCodeChallenge()
public String getCodeChallenge()
Get the code challenge (details).
Type | Description |
String |
getCodeChallengeMethod()
public String getCodeChallengeMethod()
Get the code challenge method (details).
Type | Description |
String |
set(String fieldName, Object value)
public AuthorizationCodeRequestUrl set(String fieldName, Object value)
Name | Description |
fieldName | String |
value | Object |
Type | Description |
AuthorizationCodeRequestUrl |
setClientId(String clientId)
public AuthorizationCodeRequestUrl 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.
Name | Description |
clientId | String |
Type | Description |
AuthorizationCodeRequestUrl |
setCodeChallenge(String codeChallenge)
public void setCodeChallenge(String codeChallenge)
Set the code challenge (details).
Name | Description |
codeChallenge | String the code challenge. |
setCodeChallengeMethod(String codeChallengeMethod)
public void setCodeChallengeMethod(String codeChallengeMethod)
Set the code challenge method (details).
Name | Description |
codeChallengeMethod | String the code challenge method. |
setRedirectUri(String redirectUri)
public AuthorizationCodeRequestUrl 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.
Name | Description |
redirectUri | String |
Type | Description |
AuthorizationCodeRequestUrl |
setResponseTypes(Collection<String> responseTypes)
public AuthorizationCodeRequestUrl 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.
Name | Description |
responseTypes | Collection<String> |
Type | Description |
AuthorizationCodeRequestUrl |
setScopes(Collection<String> scopes)
public AuthorizationCodeRequestUrl 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.
Name | Description |
scopes | Collection<String> |
Type | Description |
AuthorizationCodeRequestUrl |
setState(String state)
public AuthorizationCodeRequestUrl 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.
Name | Description |
state | String |
Type | Description |
AuthorizationCodeRequestUrl |