Commits

明点软件 committed cdfd37d

增加expireSession() 方法

  • Participants
  • Parent commits b33d8c3

Comments (0)

Files changed (1)

File src/groovy/com/mingidea/security/taobao/util/ExSpringSecurityUtils.groovy

         return getSessionRegistry().getAllPrincipals()
     }
     
-    static boolean removeSession(Object userId) {
+    /**
+     * 
+     * @return 用户不存在返回false,销毁session成功返回true
+     */
+    static boolean expireSession(Object userId) {
         SessionRegistry sessionRegistry = getSessionRegistry()
         List allPrincipals = sessionRegistry.getAllPrincipals()
         
         if(!user) {
             return false
         }
-        List sessions = sessionRegistry.getAllSessions(user, true)
+        List sessions = sessionRegistry.getAllSessions(user, false)
         sessions.each{
-            sessionRegistry.removeSessionInformation(it.sessionId)
+            it.expireNow()
         }
     }