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.SerializableA 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 classOAuth2AuthorizationRequest.BuilderA builder forOAuth2AuthorizationRequest.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static OAuth2AuthorizationRequest.BuilderauthorizationCode()Returns a newOAuth2AuthorizationRequest.Builder, initialized with the authorization code grant type.static OAuth2AuthorizationRequest.Builderfrom(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> TgetAttribute(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.StringgetAuthorizationRequestUri()Returns theURIstring representation of the OAuth 2.0 Authorization Request.java.lang.StringgetAuthorizationUri()Returns the uri for the authorization endpoint.java.lang.StringgetClientId()Returns the client identifier.AuthorizationGrantTypegetGrantType()Returns thegrant type.java.lang.StringgetRedirectUri()Returns the uri for the redirection endpoint.OAuth2AuthorizationResponseTypegetResponseType()Returns theresponse type.java.util.Set<java.lang.String>getScopes()Returns the scope(s).java.lang.StringgetState()Returns the state.static OAuth2AuthorizationRequest.Builderimplicit()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
Setif 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
Mapof the additional parameter(s), or an emptyMapif not available
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Returns the attribute(s) associated to the request.- Returns:
- a
Mapof the attribute(s), or an emptyMapif 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
nullif not available - Since:
- 5.2
-
getAuthorizationRequestUri
public java.lang.String getAuthorizationRequestUri()
Returns theURIstring representation of the OAuth 2.0 Authorization Request.NOTE: The
URIstring is encoded in theapplication/x-www-form-urlencodedMIME format.- Returns:
- the
URIstring 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
-
-