소스 검색

SEC-1519: Added extra constructor to make sure strategy objects are initialized before the first attempt to retrieve an object from the Acl cache.

Luke Taylor 15 년 전
부모
커밋
97bc240602
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java

+ 14 - 0
acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java

@@ -46,11 +46,25 @@ public class EhCacheBasedAclCache implements AclCache {
 
     //~ Constructors ===================================================================================================
 
+    /**
+     * @deprecated use the second constructor which injects the strategy objects. See SEC-1498.
+     */
+    @Deprecated
     public EhCacheBasedAclCache(Ehcache cache) {
         Assert.notNull(cache, "Cache required");
         this.cache = cache;
     }
 
+    public EhCacheBasedAclCache(Ehcache cache, PermissionGrantingStrategy permissionGrantingStrategy,
+            AclAuthorizationStrategy aclAuthorizationStrategy) {
+        Assert.notNull(cache, "Cache required");
+        Assert.notNull(permissionGrantingStrategy, "PermissionGrantingStrategy required");
+        Assert.notNull(aclAuthorizationStrategy, "AclAuthorizationStrategy required");
+        this.cache = cache;
+        this.permissionGrantingStrategy = permissionGrantingStrategy;
+        this.aclAuthorizationStrategy = aclAuthorizationStrategy;
+    }
+
     //~ Methods ========================================================================================================
 
     public void evictFromCache(Serializable pk) {