添加山东通单点登录

This commit is contained in:
huangweixiong 2022-11-11 14:18:14 +08:00
parent 4ed920651a
commit 35fe09a3e4
2 changed files with 5 additions and 4 deletions

View File

@ -206,13 +206,14 @@ public class Oauth2Filter extends AuthenticatingFilter {
Integer expiresOffset = 60 * 5; Integer expiresOffset = 60 * 5;
expiresIn = expiresIn < expiresOffset ? expiresIn / 2 : expiresIn -expiresOffset; expiresIn = expiresIn < expiresOffset ? expiresIn / 2 : expiresIn -expiresOffset;
token.expiresIn = DateUtil.offset(new Date(), DateField.SECOND, expiresIn); token.expiresIn = DateUtil.offset(new Date(), DateField.SECOND, expiresIn);
sdtToken = token;
} }
} }
} }
} }
UrlBuilder urlBuilder = UrlBuilder.ofHttp(requestUri, CharsetUtil.CHARSET_UTF_8); UrlBuilder urlBuilder = UrlBuilder.ofHttp(requestUri, CharsetUtil.CHARSET_UTF_8);
CharSequence code = urlBuilder.getQuery().get("code"); CharSequence code = urlBuilder.getQuery().get("code");
String userInfoUrl = String.format("%s/cgi-bin/user/getuserinfo?access_token=&s&code=%s", String userInfoUrl = String.format("%s/cgi-bin/user/getuserinfo?access_token=%s&code=%s",
apiUrl, apiUrl,
sdtToken.accessToken, sdtToken.accessToken,
code); code);
@ -240,8 +241,8 @@ public class Oauth2Filter extends AuthenticatingFilter {
cookie.setPath("/"); cookie.setPath("/");
response.addCookie(cookie); response.addCookie(cookie);
response.addHeader(Constant.TOKEN_HEADER, currentToken); response.addHeader(Constant.TOKEN_HEADER, currentToken);
//去掉凭证参数 //回调不涉及其他页面回调先写死回调首页
String removeCreditParame = ssoValidator.removeCreditParame(requestUri); String removeCreditParame = "http://" + urlBuilder.getHost() + ":" + urlBuilder.getPort() + "/#/home";
response.addHeader("REDIRECT", removeCreditParame); response.addHeader("REDIRECT", removeCreditParame);
request.setAttribute(Constant.TOKEN_HEADER, currentToken); request.setAttribute(Constant.TOKEN_HEADER, currentToken);
return executeLogin(request, response); return executeLogin(request, response);

View File

@ -165,5 +165,5 @@ shangdongtong:
corpid: wwafa1a3005a15a672 corpid: wwafa1a3005a15a672
agentId: 1001129 agentId: 1001129
secret: fCcaNBVkCosL_O3cnQVQ0brqUUBZu3ruXuISj5k8FP8 secret: fCcaNBVkCosL_O3cnQVQ0brqUUBZu3ruXuISj5k8FP8
url: http://59.206.205.195:80 url: http://15.72.183.90:7008/sdt