diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsLoginInterceptor.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java similarity index 85% rename from zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsLoginInterceptor.java rename to zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java index 41960d95..f7515c4d 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsLoginInterceptor.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java @@ -1,8 +1,11 @@ package com.zheng.upms.server.interceptor; import com.zheng.upms.dao.model.UpmsUser; +import com.zheng.upms.server.controller.manage.UpmsOrganizationController; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; @@ -13,7 +16,9 @@ import javax.servlet.http.HttpServletResponse; * 登录信息拦截器 * Created by shuzheng on 2017/2/11. */ -public class UpmsLoginInterceptor extends HandlerInterceptorAdapter { +public class UpmsInterceptor extends HandlerInterceptorAdapter { + + private static Logger _log = LoggerFactory.getLogger(UpmsInterceptor.class); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/listener/ShiroSessionListener.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/listener/ShiroSessionListener.java deleted file mode 100644 index 1541132f..00000000 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/listener/ShiroSessionListener.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.zheng.upms.server.listener; - -import org.apache.shiro.session.Session; -import org.apache.shiro.session.SessionListener; - -/** - * Created by shuzheng on 2017/2/12. - */ -public class ShiroSessionListener implements SessionListener { - - @Override - public void onStart(Session session) { - System.out.println(session.toString()); - System.out.println("会话创建:" + session.getId()); - } - - @Override - public void onStop(Session session) { - System.out.println(session.toString()); - System.out.println("会话停止:" + session.getId()); - } - - @Override - public void onExpiration(Session session) { - System.out.println(session.toString()); - System.out.println("会话过期:" + session.getId()); - } - -} diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/realm/UpmsRealm.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/shiro/realm/UpmsRealm.java similarity index 91% rename from zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/realm/UpmsRealm.java rename to zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/shiro/realm/UpmsRealm.java index ce8aad8c..0746d071 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/realm/UpmsRealm.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/shiro/realm/UpmsRealm.java @@ -1,4 +1,4 @@ -package com.zheng.upms.server.realm; +package com.zheng.upms.server.shiro.realm; import com.zheng.common.util.MD5Util; import com.zheng.upms.dao.model.UpmsPermission; @@ -40,7 +40,6 @@ public class UpmsRealm extends AuthorizingRealm { */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { - // 当前用户 UpmsUser upmsUser = (UpmsUser) principalCollection.getPrimaryPrincipal(); // 当前用户所有权限 @@ -75,13 +74,13 @@ public class UpmsRealm extends AuthorizingRealm { UpmsUser upmsUser = upmsUserService.selectFirstByExample(upmsUserExample); if (null == upmsUser) { - throw new UnknownAccountException("帐号不存在!"); + throw new UnknownAccountException(); } if (!upmsUser.getPassword().equals(MD5Util.MD5(password + upmsUser.getSalt()))) { - throw new IncorrectCredentialsException("密码错误!"); + throw new IncorrectCredentialsException(); } if (upmsUser.getLocked() == 1) { - throw new LockedAccountException("账号已被锁定!"); + throw new LockedAccountException(); } return new SimpleAuthenticationInfo(upmsUser, password, getName()); diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/util/SystemConstant.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/util/SystemConstant.java deleted file mode 100644 index 378b4e41..00000000 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/util/SystemConstant.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.zheng.upms.server.util; - -/** - * Created by shuzheng on 2017/1/19. - */ -public class SystemConstant { - - public static final int SUCCESS = 10000; // 成功 - - public static final int NO_USERNAME = 10001; // 帐号为空 - public static final int NO_PASSWORD = 10002; // 密码为空 - public static final int ERROR_ACCOUNT = 10003; // 帐号或密码错误 - public static final int ERROR_USERNAME = 10004; // 帐号不存在 - public static final int ERROR_PASSWORD = 10005; // 密码错误 - public static final int INVALID_ACCOUNT = 10006; // 帐号被封 - -} diff --git a/zheng-upms/zheng-upms-server/src/main/resources/springMVC-servlet.xml b/zheng-upms/zheng-upms-server/src/main/resources/springMVC-servlet.xml index fac7b4ca..8e3e7724 100644 --- a/zheng-upms/zheng-upms-server/src/main/resources/springMVC-servlet.xml +++ b/zheng-upms/zheng-upms-server/src/main/resources/springMVC-servlet.xml @@ -16,7 +16,7 @@ - +