SSO 0.3 登出
This commit is contained in:
parent
e79705cb98
commit
5f4fde156d
|
@ -48,7 +48,8 @@ public class SSOLoginPugin implements ThirdSSOAuthHandler {
|
||||||
String urlToRedirectTo = "";
|
String urlToRedirectTo = "";
|
||||||
String path = request.getRequestURI();
|
String path = request.getRequestURI();
|
||||||
if (path.contains("/auth/logout.do")) {
|
if (path.contains("/auth/logout.do")) {
|
||||||
urlToRedirectTo = StringUtils.getPathString(this.casSeverLoginUrl) + "logout?service=" + RevProxyUtil.getURLContextPath(request);
|
urlToRedirectTo = initCasLogoutUrl() + "?service=" + service;
|
||||||
|
// urlToRedirectTo = StringUtils.getPathString(this.casSeverLoginUrl) + "logout?service=" + RevProxyUtil.getURLContextPath(request);
|
||||||
} else {
|
} else {
|
||||||
String serviceUrl = this.constructServiceUrl(request, response);
|
String serviceUrl = this.constructServiceUrl(request, response);
|
||||||
logger.debug(String.format("Constructed service url: %s", serviceUrl));
|
logger.debug(String.format("Constructed service url: %s", serviceUrl));
|
||||||
|
@ -74,6 +75,16 @@ public class SSOLoginPugin implements ThirdSSOAuthHandler {
|
||||||
return configLoginUrl;
|
return configLoginUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String initCasLogoutUrl() {
|
||||||
|
String configLogoutUrl = System.getProperty("cas.sso.ca10.logouturl");
|
||||||
|
if (configLogoutUrl == null) {
|
||||||
|
configLogoutUrl = "https://oa-uat.elmleaf.com.cn/sso/logout";
|
||||||
|
logger.error("没有配置 sso 登录cas.sso.ca10.logouturl");
|
||||||
|
}
|
||||||
|
|
||||||
|
return configLogoutUrl;
|
||||||
|
}
|
||||||
|
|
||||||
// 该方法实现第三发插件认证及认证结果的返回
|
// 该方法实现第三发插件认证及认证结果的返回
|
||||||
public UserAuthResult getTrdSSOAuth(HttpServletRequest request, HttpServletResponse response) {
|
public UserAuthResult getTrdSSOAuth(HttpServletRequest request, HttpServletResponse response) {
|
||||||
UserAuthResult result = new UserAuthResult();
|
UserAuthResult result = new UserAuthResult();
|
||||||
|
@ -88,15 +99,16 @@ public class SSOLoginPugin implements ThirdSSOAuthHandler {
|
||||||
if (CommonUtils.isNotBlank(ticket)) {
|
if (CommonUtils.isNotBlank(ticket)) {
|
||||||
try {
|
try {
|
||||||
logger.info(String.format("Attempting to validate ticket: %s", ticket));
|
logger.info(String.format("Attempting to validate ticket: %s", ticket));
|
||||||
logger.debug(String.format("Attempting to validate ticket: %s", ticket));
|
//logger.debug(String.format("Attempting to validate ticket: %s", ticket));
|
||||||
String service2 = this.constructServiceUrl(request, response);
|
String service2 = this.constructServiceUrl(request, response);
|
||||||
logger.info(String.format("Attempting to validate service2: %s", service2));
|
logger.info(String.format("Attempting to validate service2: %s", service2));
|
||||||
logger.debug(String.format("Attempting to validate service2: %s", service2));
|
//logger.debug(String.format("Attempting to validate service2: %s", service2));
|
||||||
String tempXml = HttpRequest.post("https://oa-uat.elmleaf.com.cn/sso/proxyValidate")
|
// "https://oa-uat.elmleaf.com.cn/sso/proxyValidate"
|
||||||
|
String tempXml = HttpRequest.post("http://10.157.226.9:8088/sso/proxyValidate")
|
||||||
.contentType("application/x-www-form-urlencoded")
|
.contentType("application/x-www-form-urlencoded")
|
||||||
.form("ticket",ticket)
|
.form("ticket",ticket)
|
||||||
.form("service", service2).execute().body();
|
.form("service", service2).execute().body();
|
||||||
|
logger.info(String.format("Attempting to validate tempXml: %s", tempXml));
|
||||||
if (tempXml != null) {
|
if (tempXml != null) {
|
||||||
JSONObject user = XML.toJSONObject(tempXml);
|
JSONObject user = XML.toJSONObject(tempXml);
|
||||||
String username = user.getJSONObject("cas:serviceResponse")
|
String username = user.getJSONObject("cas:serviceResponse")
|
||||||
|
|
Loading…
Reference in New Issue