介绍
处理oauth2.0请求返回结果
- 错误信息处理AuthenticationFailureHandler
- 成功信息处理AuthenticationSuccessHandler
基于项目:Spring Authorization Server
1. maven项目依赖
spring-authorization-server v0.2.2
2. 定义失败信息返回处理
@Slf4j
public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler {
private final HttpMessageConverter<Object> responseConverter = new MappingJackson2HttpMessageConverter();
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
log.warn("custom authentication failure: ", exception);
OAuth2Error error = ((OAuth2AuthenticationExc

本文介绍了如何在Spring Authorization Server中自定义OAuth2.0的授权失败和成功处理,包括错误信息处理类AuthenticationFailureHandler和成功信息处理类AuthenticationSuccessHandler的定义,以及相关配置的实现。
最低0.47元/天 解锁文章
3005

被折叠的 条评论
为什么被折叠?



