Class OAuth2AuthorizationRequest
- java.lang.Object
-
- org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest
-
- All Implemented Interfaces:
java.io.Serializable
public final class OAuth2AuthorizationRequest extends java.lang.Object implements java.io.Serializable
A representation of an OAuth 2.0 Authorization Request for the authorization code grant type or implicit grant type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OAuth2AuthorizationRequest.Builder
A builder forOAuth2AuthorizationRequest
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static OAuth2AuthorizationRequest.Builder
authorizationCode()
Returns a newOAuth2AuthorizationRequest.Builder
, initialized with the authorization code grant type.static OAuth2AuthorizationRequest.Builder
from(OAuth2AuthorizationRequest authorizationRequest)
Returns a newOAuth2AuthorizationRequest.Builder
, initialized with the values from the providedauthorizationRequest
.java.util.Map<java.lang.String,java.lang.Object>
getAdditionalParameters()
Returns the additional parameter(s) used in the request.<T> T
getAttribute(java.lang.String name)
Returns the value of an attribute associated to the request.java.util.Map<java.lang.String,java.lang.Object>
getAttributes()
Returns the attribute(s) associated to the request.java.lang.String
getAuthorizationRequestUri()
Returns theURI
string representation of the OAuth 2.0 Authorization Request.java.lang.String
getAuthorizationUri()
Returns the uri for the authorization endpoint.java.lang.String
getClientId()
Returns the client identifier.AuthorizationGrantType
getGrantType()
Returns thegrant type
.java.lang.String
getRedirectUri()
Returns the uri for the redirection endpoint.OAuth2AuthorizationResponseType
getResponseType()
Returns theresponse type
.java.util.Set<java.lang.String>
getScopes()
Returns the scope(s).java.lang.String
getState()
Returns the state.static OAuth2AuthorizationRequest.Builder
implicit()
Deprecated.It is not recommended to use the implicit flow due to the inherent risks of returning access tokens in an HTTP redirect without any confirmation that it has been received by the client.
-
-
-
Method Detail
-
getAuthorizationUri
public java.lang.String getAuthorizationUri()
Returns the uri for the authorization endpoint.- Returns:
- the uri for the authorization endpoint
-
getGrantType
public AuthorizationGrantType getGrantType()
Returns thegrant type
.- Returns:
- the
AuthorizationGrantType
-
getResponseType
public OAuth2AuthorizationResponseType getResponseType()
Returns theresponse type
.- Returns:
- the
OAuth2AuthorizationResponseType
-
getClientId
public java.lang.String getClientId()
Returns the client identifier.- Returns:
- the client identifier
-
getRedirectUri
public java.lang.String getRedirectUri()
Returns the uri for the redirection endpoint.- Returns:
- the uri for the redirection endpoint
-
getScopes
public java.util.Set<java.lang.String> getScopes()
Returns the scope(s).- Returns:
- the scope(s), or an empty
Set
if not available
-
getState
public java.lang.String getState()
Returns the state.- Returns:
- the state
-
getAdditionalParameters
public java.util.Map<java.lang.String,java.lang.Object> getAdditionalParameters()
Returns the additional parameter(s) used in the request.- Returns:
- a
Map
of the additional parameter(s), or an emptyMap
if not available
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Returns the attribute(s) associated to the request.- Returns:
- a
Map
of the attribute(s), or an emptyMap
if not available - Since:
- 5.2
-
getAttribute
public <T> T getAttribute(java.lang.String name)
Returns the value of an attribute associated to the request.- Type Parameters:
T
- the type of the attribute- Parameters:
name
- the name of the attribute- Returns:
- the value of the attribute associated to the request, or
null
if not available - Since:
- 5.2
-
getAuthorizationRequestUri
public java.lang.String getAuthorizationRequestUri()
Returns theURI
string representation of the OAuth 2.0 Authorization Request.NOTE: The
URI
string is encoded in theapplication/x-www-form-urlencoded
MIME format.- Returns:
- the
URI
string representation of the OAuth 2.0 Authorization Request - Since:
- 5.1
-
authorizationCode
public static OAuth2AuthorizationRequest.Builder authorizationCode()
Returns a newOAuth2AuthorizationRequest.Builder
, initialized with the authorization code grant type.- Returns:
- the
OAuth2AuthorizationRequest.Builder
-
implicit
@Deprecated public static OAuth2AuthorizationRequest.Builder implicit()
Deprecated.It is not recommended to use the implicit flow due to the inherent risks of returning access tokens in an HTTP redirect without any confirmation that it has been received by the client.Returns a newOAuth2AuthorizationRequest.Builder
, initialized with the implicit grant type.- Returns:
- the
OAuth2AuthorizationRequest.Builder
- See Also:
- OAuth 2.0 Implicit Grant
-
from
public static OAuth2AuthorizationRequest.Builder from(OAuth2AuthorizationRequest authorizationRequest)
Returns a newOAuth2AuthorizationRequest.Builder
, initialized with the values from the providedauthorizationRequest
.- Parameters:
authorizationRequest
- the authorization request used for initializing theOAuth2AuthorizationRequest.Builder
- Returns:
- the
OAuth2AuthorizationRequest.Builder
- Since:
- 5.1
-
-