提交人:邹江涛
提交时间:2025年12月29日 提交内容:单点登录代码(删除不需要的代码,调整退出系统单点到新eoss登录地址)
This commit is contained in:
parent
a618d7bc48
commit
90c8796a09
|
|
@ -1,21 +1,15 @@
|
|||
package shkd.sys.sys.eoss;
|
||||
|
||||
import kd.bos.cache.CacheFactory;
|
||||
import kd.bos.cache.DistributeSessionlessCache;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.login.thirdauth.ThirdSSOAuthHandler;
|
||||
import kd.bos.login.thirdauth.UserAuthResult;
|
||||
import kd.bos.login.thirdauth.UserProperType;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -30,8 +24,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
|||
private final String CLIENT_ID2 = System.getProperty("scnyfz-clientKey");
|
||||
private final String CLIENT_SECRET2 = System.getProperty("scnyfz-scict");
|
||||
private final String EOSS_IP2 = System.getProperty("scnyfz-ip2");
|
||||
private final String skIP = System.getProperty("backlog-url");
|
||||
|
||||
|
||||
/**
|
||||
* 方法实现用户没有登录的时候跳转认证中心的登录地址
|
||||
|
|
@ -39,17 +31,9 @@ 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;
|
||||
try {
|
||||
//退出系统
|
||||
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
|
||||
String isNew = cache.get("isNew");
|
||||
if (StringUtils.equals("true", isNew)) {
|
||||
ip = EOSS_IP2;
|
||||
} else {
|
||||
ip = EOSS_IP;
|
||||
}
|
||||
httpServletResponse.sendRedirect(ip + "/service/SGE-project-sctz-master/pc/dist/login.html");
|
||||
httpServletResponse.sendRedirect(EOSS_IP2 + "/service/SGE-project-sctz-master/pc/dist/login.html");
|
||||
} catch (IOException e) {
|
||||
logger.info(String.format("callTrdSSOLogin→sendRedirect异常:%s", e));
|
||||
throw new RuntimeException(e);
|
||||
|
|
@ -67,12 +51,10 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
|||
String secret;
|
||||
String queryUrlOld = httpServletRequest.getQueryString();
|
||||
logger.info(String.format("getTrdSSOAuth→queryUrlOld:%s", queryUrlOld));
|
||||
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
|
||||
if (StringUtils.isNotEmpty(queryUrlOld) && queryUrlOld.contains("isNew")) {
|
||||
ip = EOSS_IP2;
|
||||
client = CLIENT_ID2;
|
||||
secret = CLIENT_SECRET2;
|
||||
cache.put("isNew", String.valueOf(queryUrlOld.contains("isNew")));
|
||||
} else {
|
||||
ip = EOSS_IP;
|
||||
client = CLIENT_ID;
|
||||
|
|
@ -93,11 +75,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
|||
//调用EOSS获取用户信息接口
|
||||
String user = AuthService.getUserInfo(access_token, ip, client, secret);
|
||||
logger.info(String.format("getTrdSSOAuth→getUserInfo返回数据:%s", user));
|
||||
String userKey = "user_sessionId_" + user;
|
||||
if (httpServletRequest.getParameter("eossSessionId") != null) {
|
||||
//存储sessionId用于退出系统
|
||||
cache.put(userKey, httpServletRequest.getParameter("eossSessionId"));
|
||||
}
|
||||
//当前返回类型手机,用户名,email,工号
|
||||
result.setUserType(UserProperType.Mobile);
|
||||
// result.setUserType(UserProperType.UserName);
|
||||
|
|
|
|||
Loading…
Reference in New Issue