|
|
@@ -0,0 +1,48 @@
|
|
|
+package cn.reghao.autodop.dmaster.auth.jwt;
|
|
|
+
|
|
|
+import cn.reghao.autodop.common.utils.JsonUtil;
|
|
|
+import cn.reghao.autodop.dmaster.auth.controller.IndexController;
|
|
|
+import lombok.Data;
|
|
|
+import org.springframework.security.core.Authentication;
|
|
|
+import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
|
|
+
|
|
|
+import javax.servlet.ServletException;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.PrintWriter;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author reghao
|
|
|
+ * @date 2020-10-01 00:02:57
|
|
|
+ */
|
|
|
+public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
|
|
|
+ @Override
|
|
|
+ public void onLogoutSuccess(HttpServletRequest request,
|
|
|
+ HttpServletResponse response,
|
|
|
+ Authentication authentication) throws IOException, ServletException {
|
|
|
+
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("code", "20000");
|
|
|
+ map.put("data", "success");
|
|
|
+ PrintWriter pt = response.getWriter();
|
|
|
+ pt.println(JsonUtil.objectToJson(map));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ static class UserResultData {
|
|
|
+ private String avatar;
|
|
|
+ private String introduction;
|
|
|
+ private String name;
|
|
|
+ private List<String> roles;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ static class UserResult {
|
|
|
+ private int code;
|
|
|
+ private UserResultData data;
|
|
|
+ }
|
|
|
+}
|