Skip to content

Commit

Permalink
# 9 修正AuthorizationFilter4Shiro,登陆超时以后,无法跳回原来的页面。
Browse files Browse the repository at this point in the history
Signed-off-by: michael.z <mail@zhangxiao.org>
  • Loading branch information
michaelzx committed Mar 13, 2015
1 parent 95fc8a4 commit 41b6ee6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/com/cnvp/paladin/plugin/shiro/AuthorizationFilter4Shiro.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected boolean isAccessAllowed(ServletRequest request,ServletResponse respons
//-----------------登陆认证------------------
HttpServletRequest req = (HttpServletRequest) request;
Subject currentUser = getSubject(request, response);
setLoginUrl(createLoginURL(req));
if (!currentUser.isAuthenticated())
return false;
//-----------------权限认证-------------
Expand All @@ -42,6 +43,18 @@ else if(user.getStr("account").equals("superadmin")){
}
}

private String createLoginURL(HttpServletRequest req) {
StringBuffer fromURL = req.getRequestURL();
String loginUrl = getLoginUrl();
int i = loginUrl.indexOf("?");
if (i!=-1) {
loginUrl = loginUrl.substring(0, i);
}
if (fromURL.length()>0)
loginUrl +="?from="+fromURL;
return loginUrl;
}

private String getActionKey(HttpServletRequest request) {
//获取所有AK
List<String> aks = JFinal.me().getAllActionKeys();
Expand Down

0 comments on commit 41b6ee6

Please sign in to comment.