Browse Source

账户中心配置

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@5922 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
yingp 9 years ago
parent
commit
504280a1f6

+ 4 - 4
src/main/java/com/uas/platform/b2b/controller/SecurityController.java

@@ -55,7 +55,7 @@ public class SecurityController {
 		String returnUrl = request.getHeader("Referer");
 		boolean cross = SSOHelper.isCrossDomain(request);
 		if (cross) {
-			request.getSession().setAttribute("SSOReferer", returnUrl);
+			request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl);
 			// 跨域情况,需要再次询问账户中心
 			returnUrl = "logout/proxy";
 		}
@@ -73,7 +73,7 @@ public class SecurityController {
 	@RequestMapping(value = "/login/page")
 	@ResponseBody
 	public ModelMap signin(HttpServletRequest request, HttpServletResponse response) throws IOException {
-		request.getSession().setAttribute("SSOReferer", request.getHeader("Referer"));
+		request.getSession().setAttribute(SSOConfig.SSOReferer, request.getHeader("Referer"));
 		SSOHelper.clearLogin(request, response);
 		String redirectUrl = SSOHelper.getRedirectRefererLoginUrl(request);
 		boolean cross = SSOHelper.isCrossDomain(request);
@@ -125,7 +125,7 @@ public class SecurityController {
 	@ResponseBody
 	public ModelMap afterCrossLogin(HttpServletRequest request, HttpServletResponse response, String replyTxt) {
 		if (!StringUtils.isEmpty(replyTxt)) {
-			Object returnUrl = request.getSession().getAttribute("SSOReferer");
+			Object returnUrl = request.getSession().getAttribute(SSOConfig.SSOReferer);
 			SSOConfig config = SSOHelper.getSSOService().getConfig();
 			AuthToken token = SSOHelper.ok(request, response, replyTxt, config.getClientPublicKey(), config.getCenterPublicKey());
 			if (token != null) {
@@ -161,7 +161,7 @@ public class SecurityController {
 		ModelMap model = new ModelMap();
 		SSOConfig config = SSOHelper.getSSOService().getConfig();
 		model.addAttribute("askUrl", config.getCrossAskOutUrl());
-		model.addAttribute("returnUrl", String.valueOf(request.getSession().getAttribute("SSOReferer")));
+		model.addAttribute("returnUrl", String.valueOf(request.getSession().getAttribute(SSOConfig.SSOReferer)));
 		return model;
 	}
 

+ 30 - 26
src/main/webapp/WEB-INF/views/normal/proxyLogin.html

@@ -3,33 +3,37 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta name="robots" content="none">
-<link href="../static/img/icon/u.png" rel="icon" type="image/x-icon" />
-<script type="text/javascript" src="../static/lib/jquery/jquery.min.js"></script>
+<base href="../" />
+<link href="static/img/icon/u.png" rel="icon" type="image/x-icon" />
+<script type="text/javascript" src="static/lib/jquery/jquery.min.js"></script>
 </head>
 <body>
-<script type="text/javascript">
-	function proxyLogin(askUrl, askData, loginUrl) {
-	    $.getJSON(askUrl + "?callback=?", {
-	    	askData: askData
-	    }, function(d){
-	    	if (d.error) {
-	    		// 跳转登录页面
-		    	window.location.href = loginUrl;
-	    	} else {
-	    		$.post('../login/crossAfter', {replyTxt: d.content} , function(e) {
-	    			// 已登录
-		    		window.location.href = e.returnUrl;
-			    }, "json");
-	    	}
-	    });
-	}
-	$.getJSON('../login/crossBefore', function(data){
-		proxyLogin(data.askUrl, data.askData, data.loginUrl);
-	});
-</script>
-<div align="center" style="margin-top: 180px;">
-	<img src="../static/img/all/loading.gif"> 
-	<p style="color: #888">正在加载中,请稍候……</p>
-</div>
+	<script type="text/javascript">
+		function proxyLogin(askUrl, askData, loginUrl) {
+			$.getJSON(askUrl + "?callback=?", {
+				askData : askData
+			}, function(d) {
+				if (d.error) {
+					// 跳转登录页面
+					window.location.href = loginUrl;
+				} else {
+					$.post('login/crossAfter', {
+						replyTxt : d.content
+					}, function(e) {
+						console.log(e);
+						// 已登录
+						window.location.href = e.returnUrl;
+					}, "json");
+				}
+			});
+		}
+		$.getJSON('login/crossBefore', function(data) {
+			proxyLogin(data.askUrl, data.askData, data.loginUrl);
+		});
+	</script>
+	<div align="center" style="margin-top: 180px;">
+		<img src="static/img/all/loading.gif">
+		<p style="color: #888">正在加载中,请稍候……</p>
+	</div>
 </body>
 </html>

+ 5 - 4
src/main/webapp/WEB-INF/views/normal/proxyLogout.html

@@ -3,8 +3,9 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta name="robots" content="none">
-<link href="../static/img/icon/u.png" rel="icon" type="image/x-icon" />
-<script type="text/javascript" src="../static/lib/jquery/jquery.min.js"></script>
+<base href="../" />
+<link href="static/img/icon/u.png" rel="icon" type="image/x-icon" />
+<script type="text/javascript" src="static/lib/jquery/jquery.min.js"></script>
 </head>
 <body>
 <script type="text/javascript">
@@ -13,12 +14,12 @@
 	    	window.location.href = retUrl;
 	    });
 	}
-	$.getJSON('../logout/crossBefore', function(data){
+	$.getJSON('logout/crossBefore', function(data){
 		proxyLogout(data.askUrl, data.returnUrl);
 	});
 </script>
 <div align="center" style="margin-top: 180px;">
-	<img src="../static/img/all/loading.gif"> 
+	<img src="static/img/all/loading.gif"> 
 	<p style="color: #888">正在加载中,请稍候……</p>
 </div>
 </body>