新oa待办跳转到待办页面bug修复5添加日志

This commit is contained in:
wenlukang1 2025-06-30 14:54:49 +08:00
parent b99c9dc761
commit a508cf5e7f
1 changed files with 19 additions and 26 deletions

View File

@ -37,6 +37,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
*/ */
@Override @Override
public void callTrdSSOLogin(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) { public void callTrdSSOLogin(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) {
logger.info(String.format("callTrdSSOLogin→httpServletRequest%s", httpServletRequest));
String ip; String ip;
String client; String client;
@ -52,29 +53,22 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
client = CLIENT_ID; client = CLIENT_ID;
secret = CLIENT_SECRET; 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 = ip + "/service/SGE-project-sctz-master/pc/dist/login.html";
//图标登录到首页 try {
if (!queryUrl.contains("yzjShareOpen.do")) { //非待办登录到首页
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", ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s",
ip, client, s); ip, client, s);
logger.info(String.format("重定向地址→sendRedirect%s", ssourl)); } else {
httpServletResponse.sendRedirect(ssourl); queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8));
} catch (IOException e) { String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest);
throw new RuntimeException(e); logger.info("callTrdSSOLogin→getURLContextPath" + skUrl);
} String redirect = skIP + "/index.html?param=" + queryUrl;
} else { logger.info("callTrdSSOLogin→skip" + redirect);
queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); //认证中心的登录地址
// String skIp = httpServletRequest.getRemo logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s));
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 {
if (httpServletRequest.getRequestURI().contains("/auth/logout.do")) { if (httpServletRequest.getRequestURI().contains("/auth/logout.do")) {
String userName = UserServiceHelper.getCurrentUser("name").getString("name"); String userName = UserServiceHelper.getCurrentUser("name").getString("name");
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); 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", ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s",
ip, client, redirect); 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"); String code = httpServletRequest.getParameter("code");
logger.info(String.format("getTrdSSOAuth→授权码code%s", code)); logger.info(String.format("getTrdSSOAuth→授权码code%s", code));
if (StringUtils.isEmpty(code)) { if (StringUtils.isEmpty(code)) {
logger.error("getTrdSSOAuth→授权码code为空");
result.setSucess(false); result.setSucess(false);
return result; return result;
} }
//调用EOSS获取token接口 //调用EOSS获取token接口
String access_token = AuthService.accessToken(code, ip, client, secret); 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获取用户信息接口 //调用EOSS获取用户信息接口
String user = AuthService.getUserInfo(access_token, ip, client, secret); 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"); String param = httpServletRequest.getParameter("param");
//解码 //解码
if (param != null) { if (param != null) {