From aa7491bb7f392e3178959f849e14e027703fa423 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期二, 14 十二月 2021 16:13:53 +0800 Subject: [PATCH] 西区大屏登录接口 --- springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLogoutSuccessHandler.java | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLogoutSuccessHandler.java b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLogoutSuccessHandler.java new file mode 100644 index 0000000..967bec0 --- /dev/null +++ b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLogoutSuccessHandler.java @@ -0,0 +1,31 @@ +package com.panzhihua.auth.handel; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; + +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.utlis.ResultUtil; + +/** + * @program: springcloud_k8s_panzhihuazhihuishequ + * @description: 登出成功处理 + * @author: huang.hongfa weixin hhf9596 qq 959656820 + * @create: 2020-11-24 16:08 + **/ +public class UserLogoutSuccessHandler implements LogoutSuccessHandler { + /** + * 用户登出返回结果 这里应该让前端清除掉Token + * + * @Author youcong + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, + Authentication authentication) { + SecurityContextHolder.clearContext(); + ResultUtil.responseJson(response, R.ok()); + } +} -- Gitblit v1.7.1