From a508cf5e7faac3ec5cff8c797e4d2850ed74bbab Mon Sep 17 00:00:00 2001 From: wenlukang1 Date: Mon, 30 Jun 2025 14:54:49 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0oa=E5=BE=85=E5=8A=9E=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=BE=85=E5=8A=9E=E9=A1=B5=E9=9D=A2bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D5=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkd/sys/sys/eoss/SSOPluginLogin.java | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java index 5f0754d..117456f 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java @@ -37,6 +37,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { */ @Override public void callTrdSSOLogin(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) { + logger.info(String.format("callTrdSSOLogin→httpServletRequest:%s", httpServletRequest)); String ip; String client; @@ -52,29 +53,22 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { client = CLIENT_ID; secret = CLIENT_SECRET; } + logger.info(String.format("callTrdSSOLogin→queryUrl:%s", queryUrl)); String ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html"; - //图标登录到首页 - if (!queryUrl.contains("yzjShareOpen.do")) { - try { + try { + //非待办登录到首页 + if (!queryUrl.contains("yzjShareOpen.do")) { //重定向的统一认证的地址 获取授权码 ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", ip, client, s); - logger.info(String.format("重定向地址→sendRedirect:%s", ssourl)); - httpServletResponse.sendRedirect(ssourl); - } catch (IOException e) { - throw new RuntimeException(e); - } - } else { - queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); -// String skIp = httpServletRequest.getRemo - String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest); - logger.info("getURLContextPath:" + skUrl); - String redirect = skIP + "/index.html?param=" + queryUrl; - logger.info("skip:" + skUrl); - //认证中心的登录地址 - logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s)); - - try { + } else { + queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); + String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest); + logger.info("callTrdSSOLogin→getURLContextPath:" + skUrl); + String redirect = skIP + "/index.html?param=" + queryUrl; + logger.info("callTrdSSOLogin→skip:" + redirect); + //认证中心的登录地址 + logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s)); if (httpServletRequest.getRequestURI().contains("/auth/logout.do")) { String userName = UserServiceHelper.getCurrentUser("name").getString("name"); DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); @@ -87,12 +81,12 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { //重定向的统一认证的地址 获取授权码 ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", ip, client, redirect); - logger.info(String.format("重定向地址→sendRedirect:%s", ssourl)); } - httpServletResponse.sendRedirect(ssourl); - } catch (IOException e) { - throw new RuntimeException(e); } + logger.info(String.format("callTrdSSOLogin→→sendRedirect:%s", ssourl)); + httpServletResponse.sendRedirect(ssourl); + } catch (IOException e) { + throw new RuntimeException(e); } } @@ -120,16 +114,15 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { String code = httpServletRequest.getParameter("code"); logger.info(String.format("getTrdSSOAuth→授权码code:%s", code)); if (StringUtils.isEmpty(code)) { - logger.error("getTrdSSOAuth→授权码code为空"); result.setSucess(false); return result; } //调用EOSS获取token接口 String access_token = AuthService.accessToken(code, ip, client, secret); - logger.info(String.format("accessToken返回数据:%s", access_token)); + logger.info(String.format("getTrdSSOAuth→accessToken返回数据:%s", access_token)); //调用EOSS获取用户信息接口 String user = AuthService.getUserInfo(access_token, ip, client, secret); - logger.info(String.format("getUserInfo返回数据:%s", user)); + logger.info(String.format("getTrdSSOAuth→getUserInfo返回数据:%s", user)); String param = httpServletRequest.getParameter("param"); //解码 if (param != null) { From d6cb67f60cbaa86fd5dc29d8c254e3172f9e34bc Mon Sep 17 00:00:00 2001 From: wenlukang1 Date: Mon, 30 Jun 2025 17:04:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0oa=E5=BE=85=E5=8A=9E=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=BE=85=E5=8A=9E=E9=A1=B5=E9=9D=A2bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkd/sys/sys/eoss/SSOPluginLogin.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java index 117456f..fa96f17 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java @@ -58,15 +58,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { try { //非待办登录到首页 if (!queryUrl.contains("yzjShareOpen.do")) { - //重定向的统一认证的地址 获取授权码 - ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", - ip, client, s); - } else { - queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); - String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest); - logger.info("callTrdSSOLogin→getURLContextPath:" + skUrl); - String redirect = skIP + "/index.html?param=" + queryUrl; - logger.info("callTrdSSOLogin→skip:" + redirect); //认证中心的登录地址 logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s)); if (httpServletRequest.getRequestURI().contains("/auth/logout.do")) { @@ -77,11 +68,19 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { if (sessionId != null) { AuthService.logout(ip, sessionId); } - } else { - //重定向的统一认证的地址 获取授权码 - ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", - ip, client, redirect); } + //重定向的统一认证的地址 获取授权码 + ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", + ip, client, s); + } else { + queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); + String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest); + logger.info("callTrdSSOLogin→getURLContextPath:" + skUrl); + String redirect = skIP + "/index.html?param=" + queryUrl; + logger.info("callTrdSSOLogin→skip:" + redirect); + //重定向的统一认证的地址 获取授权码 + ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", + ip, client, redirect); } logger.info(String.format("callTrdSSOLogin→→sendRedirect:%s", ssourl)); httpServletResponse.sendRedirect(ssourl); From 61a224f9cfa3ccc806dec835e79a5b7aeeff7631 Mon Sep 17 00:00:00 2001 From: wenlukang1 Date: Mon, 30 Jun 2025 17:08:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0oa=E5=BE=85=E5=8A=9E=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=BE=85=E5=8A=9E=E9=A1=B5=E9=9D=A2bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java index fa96f17..0349f49 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java @@ -54,12 +54,15 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { secret = CLIENT_SECRET; } logger.info(String.format("callTrdSSOLogin→queryUrl:%s", queryUrl)); - String ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html"; + String ssourl; try { //非待办登录到首页 if (!queryUrl.contains("yzjShareOpen.do")) { //认证中心的登录地址 logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s)); + //重定向的统一认证的地址 获取授权码 + ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", + ip, client, s); if (httpServletRequest.getRequestURI().contains("/auth/logout.do")) { String userName = UserServiceHelper.getCurrentUser("name").getString("name"); DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); @@ -68,10 +71,8 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { if (sessionId != null) { AuthService.logout(ip, sessionId); } + ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html"; } - //重定向的统一认证的地址 获取授权码 - ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s", - ip, client, s); } else { queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest); From aa0197bd1630a968d5df33ed379d313732796d45 Mon Sep 17 00:00:00 2001 From: wenlukang1 Date: Mon, 30 Jun 2025 17:36:27 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0oa=E5=BE=85=E5=8A=9E=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=BE=85=E5=8A=9E=E9=A1=B5=E9=9D=A2bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java index 0349f49..4ac83bd 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java @@ -57,7 +57,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { String ssourl; try { //非待办登录到首页 - if (!queryUrl.contains("yzjShareOpen.do")) { + if (!queryUrl.contains("wf_approvalpage")) { //认证中心的登录地址 logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s)); //重定向的统一认证的地址 获取授权码