From d94c8b442b793981a23650cbfa99847ecbce71c1 Mon Sep 17 00:00:00 2001 From: owan Date: Mon, 11 Nov 2024 13:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96code=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/shkd/sys/sys/eoss/SSOPluginLogin.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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 2d46954..2b3e737 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 @@ -1,4 +1,4 @@ -package shkd.sys.sys.eoss; +package chuantou; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -7,6 +7,7 @@ import kd.bos.logging.LogFactory; import kd.bos.login.thirdauth.ThirdSSOAuthHandler; import kd.bos.login.thirdauth.UserAuthResult; import org.apache.commons.lang3.StringUtils; +import shkd.sys.sys.eoss.AuthService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -15,9 +16,7 @@ import java.io.IOException; import static kd.bos.login.thirdauth.UserProperType.UserName; /** - * @program: laxv-cosmic * @author: Lang - * @create: 2024-09-27 15:48 * @description: 单点登录-川投统一认证 **/ public class SSOPluginLogin implements ThirdSSOAuthHandler { @@ -33,7 +32,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { */ @Override public void callTrdSSOLogin(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) { - s = "http://10.1.7.85:8022/ierp/auth/callbackTrdSSO.do?tenantNo=ctsk-dev&sandboxNo=2063179586270661632"; //认证中心的登录地址 logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s",EOSS_IP,CLIENT_ID,CLIENT_SECRET,s)); try { @@ -42,7 +40,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { * 获取授权码 */ String ssourl=String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&authType=0&redirect_uri=%s", - EOSS_IP,CLIENT_ID,EOSS_IP); + EOSS_IP,CLIENT_ID,s); logger.info(String.format("重定向地址→sendRedirect:%s",ssourl)); httpServletResponse.sendRedirect(ssourl); } catch (IOException e) { @@ -59,7 +57,11 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { @Override public UserAuthResult getTrdSSOAuth(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { logger.info(String.format("getTrdSSOAuth→httpServletRequest:%s",httpServletRequest)); - String code = httpServletRequest.getParameter("code"); + //获取返回的授权码 + String queryString = httpServletRequest.getQueryString(); + JSONObject queryBody = JSON.parseObject(queryString); + logger.info(String.format("getTrdSSOAuth→queryString:%s,授权码:%s",queryString, httpServletRequest.getParameter("code"))); + String code = queryBody.getString("code"); //返回的认证结果 UserAuthResult result=new UserAuthResult(); if (StringUtils.isEmpty(code)){