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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonAuthenticationFailure(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException authenticationException) Called when an authentication attempt fails.voidsetErrorResponseConverter(org.springframework.http.converter.HttpMessageConverter<OAuth2Error> errorResponseConverter) Sets theHttpMessageConverterused for converting anOAuth2Errorto an HTTP response.
-
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:AuthenticationFailureHandlerCalled when an authentication attempt fails.- Specified by:
onAuthenticationFailurein interfaceAuthenticationFailureHandler- 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:
IOExceptionjakarta.servlet.ServletException
-
setErrorResponseConverter
public void setErrorResponseConverter(org.springframework.http.converter.HttpMessageConverter<OAuth2Error> errorResponseConverter) Sets theHttpMessageConverterused for converting anOAuth2Errorto an HTTP response.- Parameters:
errorResponseConverter- theHttpMessageConverterused for converting anOAuth2Errorto an HTTP response
-