Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jojozhai committed Aug 31, 2017
1 parent ff5eafe commit a76fdf2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ protected void configure(HttpSecurity http) throws Exception {
securityProperties.getBrowser().getLoginPage(),
SecurityConstants.DEFAULT_VALIDATE_CODE_URL_PREFIX+"/*",
securityProperties.getBrowser().getSignUpUrl(),
"/user/regist", "/session/invalid")
securityProperties.getBrowser().getSession().getSessionInvalidUrl()+".json",
securityProperties.getBrowser().getSession().getSessionInvalidUrl()+".html",
"/user/regist")
.permitAll()
.anyRequest()
.authenticated()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public SocialUserInfo getSocialUserInfo(HttpServletRequest request) {
return userInfo;
}

@GetMapping(SecurityConstants.DEFAULT_SESSION_INVALID_URL)
@GetMapping(SecurityConstants.DEFAULT_SESSION_INVALID_URL+".json")
@ResponseStatus(code = HttpStatus.UNAUTHORIZED)
public SimpleResponse sessionInvalid(boolean concurrency) {
String message = "session失效";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ protected void onSessionInvalid(HttpServletRequest request, HttpServletResponse
}

String sourceUrl = request.getRequestURI();
String targetUrl = destinationUrl;
String targetUrl;

if (StringUtils.endsWithIgnoreCase(sourceUrl, ".html")) {
targetUrl = destinationUrl + ".html";
targetUrl = destinationUrl+".html";
}else{
targetUrl = destinationUrl+".json";
}

logger.info("session失效,跳转到" + targetUrl);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Session失效</title>
</head>
<body>
<h2>session失效页面</h2>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class ImoocConnectionStatusView extends AbstractView {
/* (non-Javadoc)
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@SuppressWarnings("unchecked")
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Expand Down

0 comments on commit a76fdf2

Please sign in to comment.