From 8781cfd7935ea2cde6ecc7c1148a0ff66547fda0 Mon Sep 17 00:00:00 2001 From: 段冬梅 Date: Fri, 14 Dec 2018 09:47:00 +0800 Subject: 恢复UserController上次提交 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/web/controller/sys/UserController.java | 42 ++-------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/nis/web/controller/sys/UserController.java b/src/main/java/com/nis/web/controller/sys/UserController.java index 43399a2..27e4a68 100644 --- a/src/main/java/com/nis/web/controller/sys/UserController.java +++ b/src/main/java/com/nis/web/controller/sys/UserController.java @@ -11,6 +11,7 @@ import org.apache.commons.beanutils.BeanUtils; import org.apache.derby.tools.sysinfo; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.cache.Cache; import org.apache.shiro.mgt.RealmSecurityManager; @@ -292,44 +293,6 @@ public class UserController extends BaseController{ if (StringUtils.validatePassword(oldPassword, user.getPassword())){ userService.updatePasswordById(user.getId(), user.getLoginId(), newPassword); - systemService.deleteSession(UserUtils.getSession()); - RealmSecurityManager securityManager = - (RealmSecurityManager) SecurityUtils.getSecurityManager(); - Collection realm=securityManager.getRealms(); - for (Realm realm2 : realm) { - SystemAuthorizingRealm userRealm = (SystemAuthorizingRealm) realm2; - userRealm.clearCachedAuthorizationInfo(UserUtils.getPrincipal()); - userRealm.clearCachedAuthenticationInfo(UserUtils.getPrincipal()); - - /* new UsernamePasswordToken(UserUtils.getUser(), UserUtils.getUser().getpas.toCharArray(), rememberMe, host, captcha, mobile);*/ - - Cache cache= userRealm.getAuthenticationCache(); - for (AuthenticationInfo auth : cache.values()) { - /*auth.getPrincipals().getPrimaryPrincipal()*/ - userRealm.getAuthenticationCache().remove(auth.getPrincipals().getPrimaryPrincipal()); - } - } - /*userRealm.clearCachedAuthorizationInfoC(SecurityUtils.getSubject().getPreviousPrincipals());*/ - - - - /*Cache cache=SecurityUtils.getSecurityManager() getAvailableAuthenticationCache();; - Object cacheKey=""; - for (Object cacheKey1 : cache.keys()) { - cacheKey=cacheKey1; - System.out.println(cacheKey); - System.out.println(userRealm.getAuthenticationCache().get(cacheKey)); - AuthenticationInfo auth=cache.get(cacheKey); - userRealm.clearCachedAuthorizationInfoC(auth.getPrincipals()); - }*/ - /*userRealm.getAuthenticationCache().remove(cacheKey); - userRealm.getAuthenticationCache().remove(cacheKey); - for (AuthenticationInfo auth : cache.values()) { - //userRealm.clearCachedAuthorizationInfoC(auth.getPrincipals()); - userRealm.getAuthenticationCache().remove(auth.getPrincipals()); - } - Cache cache2=userRealm.getAuthenticationCache();*/ - /*UserUtils.getSubject().logout();*/ model.addAttribute("message", "update_success"); }else{ model.addAttribute("message", "update_failed"); @@ -338,8 +301,7 @@ public class UserController extends BaseController{ model.addAttribute("user", user); return "/sys/userModifyPwd"; } - - + } -- cgit v1.2.3