0
我正在關注本教程https://spring.io/guides/tutorials/spring-boot-oauth2/,我設置了自定義auth-server和2個客戶端。現在我無法使用客戶端註銷,我所嘗試的是使用客戶端X註銷並希望我的客戶端Z從Facebook或Github中註銷。 在這方面的任何幫助,將有助於無法使用客戶端應用程序登出
我正在關注本教程https://spring.io/guides/tutorials/spring-boot-oauth2/,我設置了自定義auth-server和2個客戶端。現在我無法使用客戶端註銷,我所嘗試的是使用客戶端X註銷並希望我的客戶端Z從Facebook或Github中註銷。 在這方面的任何幫助,將有助於無法使用客戶端應用程序登出
好吧,我發現,我需要的是打電話給我的客戶的前端window.location ="http://localhost:8008/logout";
(Authorozation服務器的URL),並在我的中央授權服務器創建一個自定義logoutSuccessHandler要回客戶引薦成功登出後的網址
@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"));
}