我在https://spring.io/guides/tutorials/spring-boot-oauth2/上关注本教程,并且我已经设置了自定义身份验证服务器和2个客户端。现在我无法使用客户端注销,我正在尝试使用客户端X注销并希望我的客户端Z也可以从facebook或Github注销。 在这方面的任何帮助都会有所帮助
答案 0 :(得分:0)
好的,我发现我需要的是从我的客户端前端调用window.location ="http://localhost:8008/logout";
(Authorozation服务器的URL),并在我的中央授权服务器中创建一个自定义logoutSuccessHandler,以便在成功注销后返回客户端referer URL
@Override
public void onLogoutSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {
if(authentication != null) {
System.out.println(authentication.getName());
}
//perform other required operation
String URL = request.getContextPath();
response.setStatus(HttpStatus.OK.value());
response.sendRedirect(request.getHeader("referer"));
}