Class OAuth2ErrorAuthenticationFailureHandler

java.lang.Object
org.springframework.security.oauth2.server.authorization.web.authentication.OAuth2ErrorAuthenticationFailureHandler
All Implemented Interfaces:
AuthenticationFailureHandler

public final class OAuth2ErrorAuthenticationFailureHandler extends Object implements AuthenticationFailureHandler
An implementation of an AuthenticationFailureHandler used for handling an OAuth2AuthenticationException and returning the OAuth 2.0 Error Response.
Since:
7.0
See Also:
  • Constructor Details

    • OAuth2ErrorAuthenticationFailureHandler

      public OAuth2ErrorAuthenticationFailureHandler()
  • Method Details

    • onAuthenticationFailure

      public void onAuthenticationFailure(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException authenticationException) throws IOException, jakarta.servlet.ServletException
      Description copied from interface: AuthenticationFailureHandler
      Called when an authentication attempt fails.
      Specified by:
      onAuthenticationFailure in interface AuthenticationFailureHandler
      Parameters:
      request - the request during which the authentication attempt occurred.
      response - the response.
      authenticationException - the exception which was thrown to reject the authentication request.
      Throws:
      IOException
      jakarta.servlet.ServletException
    • setErrorResponseConverter

      public void setErrorResponseConverter(org.springframework.http.converter.HttpMessageConverter<OAuth2Error> errorResponseConverter)
      Sets the HttpMessageConverter used for converting an OAuth2Error to an HTTP response.
      Parameters:
      errorResponseConverter - the HttpMessageConverter used for converting an OAuth2Error to an HTTP response