Commit 2725aee3 authored by 喻春霖's avatar 喻春霖

fixed

parent 3ea3d50d
......@@ -261,10 +261,14 @@ public class AuthController {
authLogService.save(authLog);
if(StringUtils.isNotEmpty(service)) {
if (!OauthType.dianjiaoguan.equals(type) && !OauthType.edenoperation.equals(type)){
response.sendRedirect(service);
if (OauthType.qpjy.equals(type)){
response.sendRedirect(generateSpLogoutUrl(service,type.name()));
}
}else{
response.sendRedirect(generateLogoutUrl(service, type.name()));
}
response.sendRedirect(generateLogoutUrl(service, type.name()));
//response.sendRedirect(service);
}
return null;
} catch (Exception e) {
......@@ -470,7 +474,7 @@ public class AuthController {
if (!oauthConfigItem.getOauthUrl().endsWith("/")) {
loginUrlBuilder.append("/");
}
loginUrlBuilder.append("?client_id=").append(oauthConfigItem.getClientId());
loginUrlBuilder.append("login?client_id=").append(oauthConfigItem.getClientId());
String loginSuccessUrl = oauthConfigItem.getLoginSuccessUrl();
loginSuccessUrl = loginSuccessUrl + "?log_id=" + logId+"&oauth_type=" + oauthType ;
if (StringUtils.isNotEmpty(returnUrl)) {
......@@ -503,6 +507,26 @@ public class AuthController {
return loginUrlBuilder.toString();
}
private String generateSpLogoutUrl(String returnUrl, String oauthType) {
StringBuilder loginUrlBuilder = new StringBuilder();
OauthConfigItem oauthConfigItem = oauthConfig.getItems().get(oauthType);
loginUrlBuilder.append(oauthConfigItem.getOauthUrl());
if (!oauthConfigItem.getOauthUrl().endsWith("/")) {
loginUrlBuilder.append("/");
}
String service = oauthConfigItem.getLogoutSuccessUrl();
if (StringUtils.isNotEmpty(returnUrl)) {
Map<String, String> param = new HashMap<>();
param.put("return_url", URLEncoder.encode(returnUrl));
service = appendUrl(service, param);
}
loginUrlBuilder.append("logout?service=").append(URLEncoder.encode(service));
return loginUrlBuilder.toString();
}
private String generateUserInfoUrl(String accessToken, String oauthType) {
//String url = "http://castest.edu.sh.cn/CAS/oauth2.0/accessToken?client_id=testClentId&client_secret=testClientSecret&redirect_uri=http%3a%2f%2f192.168.17.129%3a7774%2fauth%2floginsuccess2.do&code=" + code;
StringBuilder builder = new StringBuilder();
......
......@@ -44,7 +44,7 @@ oauth:
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
qpjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth/login
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment