新oa待办跳转到待办页面bug修复5
This commit is contained in:
parent
554be3d22e
commit
22da7ad78c
|
@ -18,6 +18,7 @@ import java.util.Base64;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
||||||
private final static Log logger = LogFactory.getLog(SSOPluginLogin.class);
|
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";
|
String ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html";
|
||||||
//图标登录到首页
|
//图标登录到首页
|
||||||
if(!queryUrl.contains("yzjShareOpen.do")){
|
if (!queryUrl.contains("yzjShareOpen.do")) {
|
||||||
try {
|
try {
|
||||||
//重定向的统一认证的地址 获取授权码
|
//重定向的统一认证的地址 获取授权码
|
||||||
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",
|
||||||
|
@ -63,13 +64,13 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8));
|
queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8));
|
||||||
// String skIp = httpServletRequest.getRemo
|
// String skIp = httpServletRequest.getRemo
|
||||||
String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest);
|
String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest);
|
||||||
logger.info("getURLContextPath:"+skUrl);
|
logger.info("getURLContextPath:" + skUrl);
|
||||||
String redirect = skIP+"/index.html?param="+queryUrl;
|
String redirect = skIP + "/index.html?param=" + queryUrl;
|
||||||
logger.info("skip:"+skUrl);
|
logger.info("skip:" + skUrl);
|
||||||
//认证中心的登录地址
|
//认证中心的登录地址
|
||||||
logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s));
|
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");
|
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)) {
|
||||||
|
logger.error("getTrdSSOAuth→授权码code为空");
|
||||||
|
result.setSucess(false);
|
||||||
|
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("accessToken返回数据:%s", access_token));
|
||||||
|
@ -126,7 +132,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
||||||
logger.info(String.format("getUserInfo返回数据:%s", user));
|
logger.info(String.format("getUserInfo返回数据:%s", user));
|
||||||
String param = httpServletRequest.getParameter("param");
|
String param = httpServletRequest.getParameter("param");
|
||||||
//解码
|
//解码
|
||||||
if(param!=null){
|
if (param != null) {
|
||||||
byte[] decodedBytes = Base64.getDecoder().decode(param);
|
byte[] decodedBytes = Base64.getDecoder().decode(param);
|
||||||
String paramString = new String(decodedBytes, StandardCharsets.UTF_8);
|
String paramString = new String(decodedBytes, StandardCharsets.UTF_8);
|
||||||
try {
|
try {
|
||||||
|
@ -138,9 +144,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
||||||
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
|
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
|
||||||
cache.put(userKey, sessionId);
|
cache.put(userKey, sessionId);
|
||||||
//二次重定向到待办页面,并且不携带EOSS返回的sessionId
|
//二次重定向到待办页面,并且不携带EOSS返回的sessionId
|
||||||
httpServletResponse.sendRedirect(httpServletRequest.getRequestURI()+"?"+paramString+"&code="+code);
|
httpServletResponse.sendRedirect(httpServletRequest.getRequestURI() + "?" + paramString + "&code=" + code);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("二次重定向到待办页面异常!"+e.getMessage());
|
logger.error("二次重定向到待办页面异常!" + e.getMessage());
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
result.setSucess(false);
|
result.setSucess(false);
|
||||||
|
@ -148,11 +154,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
||||||
}
|
}
|
||||||
//二次重定向进入
|
//二次重定向进入
|
||||||
result.setUserType(UserProperType.UserName);
|
result.setUserType(UserProperType.UserName);
|
||||||
if (StringUtils.isEmpty(code)) {
|
if (StringUtils.isNotEmpty(code) && user != null) {
|
||||||
logger.error("getTrdSSOAuth→授权码code为空");
|
|
||||||
result.setSucess(false);
|
|
||||||
return result;
|
|
||||||
} else if (StringUtils.isNotEmpty(code) && user != null) {
|
|
||||||
//当前返回类型手机,用户名,email,工号
|
//当前返回类型手机,用户名,email,工号
|
||||||
result.setUserType(UserProperType.UserName);
|
result.setUserType(UserProperType.UserName);
|
||||||
result.setUser(user);
|
result.setUser(user);
|
||||||
|
|
Loading…
Reference in New Issue