From 97bc2406027aeb67777369b7d09955275c76d563 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Fri, 23 Jul 2010 17:57:57 +0100 Subject: [PATCH] SEC-1519: Added extra constructor to make sure strategy objects are initialized before the first attempt to retrieve an object from the Acl cache. --- .../security/acls/domain/EhCacheBasedAclCache.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java b/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java index 8ea572fbea..fba2b52930 100644 --- a/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java +++ b/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) {