From 177249c76aeea0b4bf8d8816d4994e3b445b45ce Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期四, 02 九月 2021 10:39:34 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/zzj' into zzj --- springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginSuccessHandler.java | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginSuccessHandler.java b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginSuccessHandler.java index 0e9314e..f5f68b0 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginSuccessHandler.java +++ b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginSuccessHandler.java @@ -1,19 +1,22 @@ package com.panzhihua.auth.handel; -import com.panzhihua.common.utlis.JWTTokenUtil; -import com.panzhihua.common.model.vos.LoginUserInfoVO; -import com.panzhihua.common.utlis.ResultUtil; -import com.panzhihua.common.constants.TokenConstant; -import com.panzhihua.common.model.vos.R; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; + +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; + +import com.panzhihua.common.constants.TokenConstant; +import com.panzhihua.common.model.vos.LoginUserInfoVO; +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.utlis.JWTTokenUtil; +import com.panzhihua.common.utlis.ResultUtil; + +import lombok.extern.slf4j.Slf4j; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -24,19 +27,21 @@ @Slf4j public class UserLoginSuccessHandler implements AuthenticationSuccessHandler { @Override - public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authentication) throws IOException, ServletException { + public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, FilterChain chain, + Authentication authentication) throws IOException, ServletException { log.info("登录成功"); } @Override - public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { + public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, + Authentication authentication) throws IOException, ServletException { log.info("登录成功"); // 组装JWT - LoginUserInfoVO loginUserInfoVO = (LoginUserInfoVO) authentication.getPrincipal(); + LoginUserInfoVO loginUserInfoVO = (LoginUserInfoVO)authentication.getPrincipal(); String token = JWTTokenUtil.generateToken(loginUserInfoVO); token = TokenConstant.TOKEN_PRE + token; // 封装返回参数 R<String> ok = R.ok(token); - ResultUtil.responseJson(httpServletResponse,ok); + ResultUtil.responseJson(httpServletResponse, ok); } } -- Gitblit v1.7.1