介绍
处理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 &