Class OAuth2AuthorizationResponse

java.lang.Object
org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationResponse

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

    • getRedirectUri

      public String getRedirectUri()
      Returns the uri where the response was redirected to.
      Returns:
      the uri where the response was redirected to
    • getState

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

      public String getCode()
      Returns the authorization code.
      Returns:
      the authorization code
    • getError

      public OAuth2Error getError()
      Returns the OAuth 2.0 Error if the Authorization Request failed, otherwise null.
      Returns:
      the OAuth2Error if the Authorization Request failed, otherwise null
    • statusOk

      public boolean statusOk()
      Returns true if the Authorization Request succeeded, otherwise false.
      Returns:
      true if the Authorization Request succeeded, otherwise false
    • statusError

      public boolean statusError()
      Returns true if the Authorization Request failed, otherwise false.
      Returns:
      true if the Authorization Request failed, otherwise false
    • success

      public static OAuth2AuthorizationResponse.Builder success(String code)
      Returns a new OAuth2AuthorizationResponse.Builder, initialized with the authorization code.
      Parameters:
      code - the authorization code
      Returns:
      the OAuth2AuthorizationResponse.Builder
    • error

      public static OAuth2AuthorizationResponse.Builder error(String errorCode)
      Returns a new OAuth2AuthorizationResponse.Builder, initialized with the error code.
      Parameters:
      errorCode - the error code
      Returns:
      the OAuth2AuthorizationResponse.Builder