Class OAuth2AuthorizationRequest

java.lang.Object
org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest
All Implemented Interfaces:
Serializable

public final class OAuth2AuthorizationRequest extends Object implements Serializable
A representation of an OAuth 2.0 Authorization Request for the authorization code grant type.
Since:
5.0
See Also:
  • Method Details

    • getAuthorizationUri

      public String getAuthorizationUri()
      Returns the uri for the authorization endpoint.
      Returns:
      the uri for the authorization endpoint
    • getGrantType

      public AuthorizationGrantType getGrantType()
      Returns the grant type.
      Returns:
      the AuthorizationGrantType
    • getResponseType

      public OAuth2AuthorizationResponseType getResponseType()
      Returns the response type.
      Returns:
      the OAuth2AuthorizationResponseType
    • getClientId

      public String getClientId()
      Returns the client identifier.
      Returns:
      the client identifier
    • getRedirectUri

      public String getRedirectUri()
      Returns the uri for the redirection endpoint.
      Returns:
      the uri for the redirection endpoint
    • getScopes

      public Set<String> getScopes()
      Returns the scope(s).
      Returns:
      the scope(s), or an empty Set if not available
    • getState

      public String getState()
      Returns the state.
      Returns:
      the state
    • getAdditionalParameters

      public Map<String,Object> getAdditionalParameters()
      Returns the additional parameter(s) used in the request.
      Returns:
      a Map of the additional parameter(s), or an empty Map if not available
    • getAttributes

      public Map<String,Object> getAttributes()
      Returns the attribute(s) associated to the request.
      Returns:
      a Map of the attribute(s), or an empty Map if not available
      Since:
      5.2
    • getAttribute

      public <T> T getAttribute(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 String getAuthorizationRequestUri()
      Returns the URI string representation of the OAuth 2.0 Authorization Request.

      NOTE: The URI string is encoded in the application/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 new OAuth2AuthorizationRequest.Builder, initialized with the authorization code grant type.
      Returns:
      the OAuth2AuthorizationRequest.Builder
    • from

      public static OAuth2AuthorizationRequest.Builder from(OAuth2AuthorizationRequest authorizationRequest)
      Returns a new OAuth2AuthorizationRequest.Builder, initialized with the values from the provided authorizationRequest.
      Parameters:
      authorizationRequest - the authorization request used for initializing the OAuth2AuthorizationRequest.Builder
      Returns:
      the OAuth2AuthorizationRequest.Builder
      Since:
      5.1