浏览代码

SEC-266: Handle -1 allowing unlimited logins, as per JavaDocs.

Ben Alex 19 年之前
父节点
当前提交
d795836bf1
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      core/src/main/java/org/acegisecurity/concurrent/ConcurrentSessionControllerImpl.java

+ 4 - 0
core/src/main/java/org/acegisecurity/concurrent/ConcurrentSessionControllerImpl.java

@@ -121,7 +121,11 @@ public class ConcurrentSessionControllerImpl
             "getMaximumSessionsForThisUser() must return either -1 to allow unlimited logins, or a positive integer to specify a maximum");
 
         if (sessionCount < allowableSessions) {
+        	// They haven't got too many login sessions running at present
             return;
+        } else if (allowableSessions == -1) {
+        	// We permit unlimited logins
+        	return;
         } else if (sessionCount == allowableSessions) {
             // Only permit it though if this request is associated with one of the sessions
             for (int i = 0; i < sessionCount; i++) {