新oa待办跳转到待办页面bug修复5

This commit is contained in:
wenlukang1 2025-06-26 23:26:23 +08:00
parent 554be3d22e
commit 22da7ad78c
1 changed files with 15 additions and 13 deletions

View File

@ -18,6 +18,7 @@ import java.util.Base64;
/**
*
**/
public class SSOPluginLogin implements ThirdSSOAuthHandler {
private final static Log logger = LogFactory.getLog(SSOPluginLogin.class);
@ -53,7 +54,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
}
String ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html";
//图标登录到首页
if(!queryUrl.contains("yzjShareOpen.do")){
if (!queryUrl.contains("yzjShareOpen.do")) {
try {
//重定向的统一认证的地址 获取授权码
ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s",
@ -63,13 +64,13 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
} catch (IOException e) {
throw new RuntimeException(e);
}
}else{
} 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("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));
@ -118,6 +119,11 @@ 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));
@ -126,7 +132,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
logger.info(String.format("getUserInfo返回数据%s", user));
String param = httpServletRequest.getParameter("param");
//解码
if(param!=null){
if (param != null) {
byte[] decodedBytes = Base64.getDecoder().decode(param);
String paramString = new String(decodedBytes, StandardCharsets.UTF_8);
try {
@ -138,9 +144,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
cache.put(userKey, sessionId);
//二次重定向到待办页面并且不携带EOSS返回的sessionId
httpServletResponse.sendRedirect(httpServletRequest.getRequestURI()+"?"+paramString+"&code="+code);
httpServletResponse.sendRedirect(httpServletRequest.getRequestURI() + "?" + paramString + "&code=" + code);
} catch (IOException e) {
logger.error("二次重定向到待办页面异常!"+e.getMessage());
logger.error("二次重定向到待办页面异常!" + e.getMessage());
throw new RuntimeException(e);
}
result.setSucess(false);
@ -148,11 +154,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
}
//二次重定向进入
result.setUserType(UserProperType.UserName);
if (StringUtils.isEmpty(code)) {
logger.error("getTrdSSOAuth→授权码code为空");
result.setSucess(false);
return result;
} else if (StringUtils.isNotEmpty(code) && user != null) {
if (StringUtils.isNotEmpty(code) && user != null) {
//当前返回类型手机用户名email工号
result.setUserType(UserProperType.UserName);
result.setUser(user);