|
@@ -68,12 +68,12 @@ public class SecurityController {
|
|
|
if (StringUtils.isEmpty(returnUrl)) {
|
|
if (StringUtils.isEmpty(returnUrl)) {
|
|
|
returnUrl = request.getHeader("Referer");
|
|
returnUrl = request.getHeader("Referer");
|
|
|
}
|
|
}
|
|
|
- boolean cross = SSOHelper.isCrossDomain(request);
|
|
|
|
|
|
|
+ /*boolean cross = SSOHelper.isCrossDomain(request);
|
|
|
if (cross) {
|
|
if (cross) {
|
|
|
request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl);
|
|
request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl);
|
|
|
// 跨域情况,需要再次询问账户中心
|
|
// 跨域情况,需要再次询问账户中心
|
|
|
- returnUrl = "/logout/proxy";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ returnUrl = request.getContextPath() + "/logout/proxy";
|
|
|
|
|
+ }*/
|
|
|
return new ModelMap("content", returnUrl);
|
|
return new ModelMap("content", returnUrl);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -96,11 +96,11 @@ public class SecurityController {
|
|
|
} else {
|
|
} else {
|
|
|
redirectUrl = SSOHelper.getRedirectLoginUrl(request, returnUrl);
|
|
redirectUrl = SSOHelper.getRedirectLoginUrl(request, returnUrl);
|
|
|
}
|
|
}
|
|
|
- boolean cross = SSOHelper.isCrossDomain(request);
|
|
|
|
|
|
|
+ /*boolean cross = SSOHelper.isCrossDomain(request);
|
|
|
if (cross) {
|
|
if (cross) {
|
|
|
// 跨域代理界面
|
|
// 跨域代理界面
|
|
|
redirectUrl = request.getContextPath() + "/login/proxy";
|
|
redirectUrl = request.getContextPath() + "/login/proxy";
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
return new ModelMap("content", redirectUrl);
|
|
return new ModelMap("content", redirectUrl);
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
@@ -167,7 +167,7 @@ public class SecurityController {
|
|
|
public ModelMap afterCrossLogin(HttpServletRequest request, HttpServletResponse response, String replyTxt) {
|
|
public ModelMap afterCrossLogin(HttpServletRequest request, HttpServletResponse response, String replyTxt) {
|
|
|
if (!StringUtils.isEmpty(replyTxt)) {
|
|
if (!StringUtils.isEmpty(replyTxt)) {
|
|
|
Object returnUrl = request.getSession().getAttribute(SSOConfig.SSOReferer);
|
|
Object returnUrl = request.getSession().getAttribute(SSOConfig.SSOReferer);
|
|
|
- returnUrl = returnUrl.toString().replaceAll("login/proxy","auth/login");
|
|
|
|
|
|
|
+// returnUrl = returnUrl.toString().replaceAll("platform-b2c/","").replaceAll("login/proxy","SSRProxy/loginProxy");
|
|
|
SSOConfig config = SSOHelper.getSSOService().getConfig();
|
|
SSOConfig config = SSOHelper.getSSOService().getConfig();
|
|
|
AuthToken token = SSOHelper.ok(request, response, replyTxt, config.getClientPublicKey(), config.getCenterPublicKey());
|
|
AuthToken token = SSOHelper.ok(request, response, replyTxt, config.getClientPublicKey(), config.getCenterPublicKey());
|
|
|
if (token != null) {
|
|
if (token != null) {
|
|
@@ -183,12 +183,39 @@ public class SecurityController {
|
|
|
SystemSession.setUser(user);
|
|
SystemSession.setUser(user);
|
|
|
log(request, user);
|
|
log(request, user);
|
|
|
}
|
|
}
|
|
|
|
|
+ returnUrl = returnUrl.toString().contains("10.10.0.10") ? "/" : returnUrl;
|
|
|
return new ModelMap("returnUrl", returnUrl);
|
|
return new ModelMap("returnUrl", returnUrl);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 其他地点登录后 同步登录状态
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param response
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/login/other")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ModelMap afterCrossLogin(HttpServletRequest request, HttpServletResponse response, String uid, long time , String data) {
|
|
|
|
|
+ if (uid != null && data != null) {
|
|
|
|
|
+ SSOToken tk = new SSOToken();
|
|
|
|
|
+ tk.setUid(uid);
|
|
|
|
|
+ tk.setTime(time);
|
|
|
|
|
+ tk.setData(data);
|
|
|
|
|
+ SSOHelper.setSSOCookie(request, response, tk, true);
|
|
|
|
|
+ User user = getUserByToken(tk);
|
|
|
|
|
+ if (user != null) {
|
|
|
|
|
+ user.setIp(AgentUtils.getIp(request));
|
|
|
|
|
+ request.getSession().setAttribute("user", user);
|
|
|
|
|
+ SystemSession.setUser(user);
|
|
|
|
|
+ log(request, user);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ModelMap("success", 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ModelMap("success", 0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取跨域登录的参数
|
|
* 获取跨域登录的参数
|
|
|
*
|
|
*
|