Remove superfluous comments
Use '^\s+//\ \~\ .*$' and '^\s+//\ ============+$' regular expression searches to remove superfluous comments. Prior to this commit, many classes would have comments to indicate blocks of code (such as constructors/methods/instance fields). These added a lot of noise and weren't all that helpful, especially given the outline views available in most modern IDEs. Issue gh-8945
This commit is contained in:
@@ -96,14 +96,8 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class AclEntryVoter extends AbstractAclVoter {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AclEntryVoter.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private AclService aclService;
|
||||
|
||||
private ObjectIdentityRetrievalStrategy objectIdentityRetrievalStrategy = new ObjectIdentityRetrievalStrategyImpl();
|
||||
@@ -116,9 +110,6 @@ public class AclEntryVoter extends AbstractAclVoter {
|
||||
|
||||
private List<Permission> requirePermission;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public AclEntryVoter(AclService aclService, String processConfigAttribute, Permission[] requirePermission) {
|
||||
Assert.notNull(processConfigAttribute, "A processConfigAttribute is mandatory");
|
||||
Assert.notNull(aclService, "An AclService is mandatory");
|
||||
@@ -132,9 +123,6 @@ public class AclEntryVoter extends AbstractAclVoter {
|
||||
this.requirePermission = Arrays.asList(requirePermission);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Optionally specifies a method of the domain object that will be used to obtain a
|
||||
* contained domain object. That contained domain object will be used for the ACL
|
||||
|
||||
-9
@@ -41,9 +41,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
protected final AclService aclService;
|
||||
|
||||
protected Class<?> processDomainObjectClass = Object.class;
|
||||
@@ -56,9 +53,6 @@ public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
||||
|
||||
protected final List<Permission> requirePermission;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public AbstractAclProvider(AclService aclService, String processConfigAttribute,
|
||||
List<Permission> requirePermission) {
|
||||
Assert.hasText(processConfigAttribute, "A processConfigAttribute is mandatory");
|
||||
@@ -73,9 +67,6 @@ public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
||||
this.requirePermission = requirePermission;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
protected Class<?> getProcessDomainObjectClass() {
|
||||
return processDomainObjectClass;
|
||||
}
|
||||
|
||||
-9
@@ -62,22 +62,13 @@ import org.springframework.security.core.Authentication;
|
||||
*/
|
||||
public class AclEntryAfterInvocationCollectionFilteringProvider extends AbstractAclProvider {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(AclEntryAfterInvocationCollectionFilteringProvider.class);
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public AclEntryAfterInvocationCollectionFilteringProvider(AclService aclService,
|
||||
List<Permission> requirePermission) {
|
||||
super(aclService, "AFTER_ACL_COLLECTION_READ", requirePermission);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config,
|
||||
Object returnedObject) throws AccessDeniedException {
|
||||
|
||||
-12
@@ -60,19 +60,10 @@ import org.springframework.security.core.SpringSecurityMessageSource;
|
||||
*/
|
||||
public class AclEntryAfterInvocationProvider extends AbstractAclProvider implements MessageSourceAware {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(AclEntryAfterInvocationProvider.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public AclEntryAfterInvocationProvider(AclService aclService, List<Permission> requirePermission) {
|
||||
this(aclService, "AFTER_ACL_READ", requirePermission);
|
||||
}
|
||||
@@ -82,9 +73,6 @@ public class AclEntryAfterInvocationProvider extends AbstractAclProvider impleme
|
||||
super(aclService, processConfigAttribute, requirePermission);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config,
|
||||
Object returnedObject) throws AccessDeniedException {
|
||||
|
||||
|
||||
-12
@@ -33,21 +33,12 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
class ArrayFilterer<T> implements Filterer<T> {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(ArrayFilterer.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final Set<T> removeList;
|
||||
|
||||
private final T[] list;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
ArrayFilterer(T[] list) {
|
||||
this.list = list;
|
||||
|
||||
@@ -57,9 +48,6 @@ class ArrayFilterer<T> implements Filterer<T> {
|
||||
removeList = new HashSet<>();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @see org.springframework.security.acls.afterinvocation.Filterer#getFilteredObject()
|
||||
|
||||
-12
@@ -32,21 +32,12 @@ import java.util.Set;
|
||||
*/
|
||||
class CollectionFilterer<T> implements Filterer<T> {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(CollectionFilterer.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final Collection<T> collection;
|
||||
|
||||
private final Set<T> removeList;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
CollectionFilterer(Collection<T> collection) {
|
||||
this.collection = collection;
|
||||
|
||||
@@ -60,9 +51,6 @@ class CollectionFilterer<T> implements Filterer<T> {
|
||||
removeList = new HashSet<>();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @see org.springframework.security.acls.afterinvocation.Filterer#getFilteredObject()
|
||||
|
||||
@@ -26,9 +26,6 @@ import java.util.Iterator;
|
||||
*/
|
||||
interface Filterer<T> extends Iterable<T> {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Gets the filtered collection or array.
|
||||
* @return the filtered collection or array
|
||||
|
||||
@@ -25,15 +25,10 @@ import org.springframework.security.acls.model.Permission;
|
||||
*/
|
||||
public abstract class AbstractPermission implements Permission {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
protected final char code;
|
||||
|
||||
protected int mask;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
/**
|
||||
* Sets the permission mask and uses the '*' character to represent active bits when
|
||||
* represented as a bit pattern string.
|
||||
@@ -55,9 +50,6 @@ public abstract class AbstractPermission implements Permission {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public final boolean equals(Object arg0) {
|
||||
if (arg0 == null) {
|
||||
return false;
|
||||
|
||||
@@ -32,9 +32,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class AccessControlEntryImpl implements AccessControlEntry, AuditableAccessControlEntry {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final Acl acl;
|
||||
|
||||
private Permission permission;
|
||||
@@ -49,9 +46,6 @@ public class AccessControlEntryImpl implements AccessControlEntry, AuditableAcce
|
||||
|
||||
private final boolean granting;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public AccessControlEntryImpl(Serializable id, Acl acl, Sid sid, Permission permission, boolean granting,
|
||||
boolean auditSuccess, boolean auditFailure) {
|
||||
Assert.notNull(acl, "Acl required");
|
||||
@@ -66,9 +60,6 @@ public class AccessControlEntryImpl implements AccessControlEntry, AuditableAcce
|
||||
this.auditFailure = auditFailure;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public boolean equals(Object arg0) {
|
||||
if (!(arg0 instanceof AccessControlEntryImpl)) {
|
||||
|
||||
-6
@@ -26,18 +26,12 @@ import org.springframework.security.acls.model.Acl;
|
||||
*/
|
||||
public interface AclAuthorizationStrategy {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
int CHANGE_OWNERSHIP = 0;
|
||||
|
||||
int CHANGE_AUDITING = 1;
|
||||
|
||||
int CHANGE_GENERAL = 2;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
void securityCheck(Acl acl, int changeType);
|
||||
|
||||
}
|
||||
|
||||
-9
@@ -46,9 +46,6 @@ import java.util.Set;
|
||||
*/
|
||||
public class AclAuthorizationStrategyImpl implements AclAuthorizationStrategy {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final GrantedAuthority gaGeneralChanges;
|
||||
|
||||
private final GrantedAuthority gaModifyAuditing;
|
||||
@@ -57,9 +54,6 @@ public class AclAuthorizationStrategyImpl implements AclAuthorizationStrategy {
|
||||
|
||||
private SidRetrievalStrategy sidRetrievalStrategy = new SidRetrievalStrategyImpl();
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructor. The only mandatory parameter relates to the system-wide
|
||||
* {@link GrantedAuthority} instances that can be held to always permit ACL changes.
|
||||
@@ -83,9 +77,6 @@ public class AclAuthorizationStrategyImpl implements AclAuthorizationStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void securityCheck(Acl acl, int changeType) {
|
||||
if ((SecurityContextHolder.getContext() == null)
|
||||
|| (SecurityContextHolder.getContext().getAuthentication() == null)
|
||||
|
||||
@@ -39,9 +39,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private Acl parentAcl;
|
||||
|
||||
private transient AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||
@@ -61,9 +58,6 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
||||
|
||||
private boolean entriesInheriting = true;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Minimal constructor, which should be used
|
||||
* {@link org.springframework.security.acls.model.MutableAclService#createAcl(ObjectIdentity)}
|
||||
@@ -125,9 +119,6 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
||||
private AclImpl() {
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void deleteAce(int aceIndex) throws NotFoundException {
|
||||
aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
|
||||
|
||||
@@ -25,9 +25,6 @@ import org.springframework.security.acls.model.AccessControlEntry;
|
||||
*/
|
||||
public interface AuditLogger {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
void logIfNeeded(boolean granted, AccessControlEntry ace);
|
||||
|
||||
}
|
||||
|
||||
@@ -27,9 +27,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ConsoleAuditLogger implements AuditLogger {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void logIfNeeded(boolean granted, AccessControlEntry ace) {
|
||||
Assert.notNull(ace, "AccessControlEntry required");
|
||||
|
||||
|
||||
@@ -39,18 +39,12 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class EhCacheBasedAclCache implements AclCache {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final Ehcache cache;
|
||||
|
||||
private PermissionGrantingStrategy permissionGrantingStrategy;
|
||||
|
||||
private AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public EhCacheBasedAclCache(Ehcache cache, PermissionGrantingStrategy permissionGrantingStrategy,
|
||||
AclAuthorizationStrategy aclAuthorizationStrategy) {
|
||||
Assert.notNull(cache, "Cache required");
|
||||
@@ -61,9 +55,6 @@ public class EhCacheBasedAclCache implements AclCache {
|
||||
this.aclAuthorizationStrategy = aclAuthorizationStrategy;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void evictFromCache(Serializable pk) {
|
||||
Assert.notNull(pk, "Primary key (identifier) required");
|
||||
|
||||
|
||||
@@ -32,14 +32,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class GrantedAuthoritySid implements Sid {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final String grantedAuthority;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public GrantedAuthoritySid(String grantedAuthority) {
|
||||
Assert.hasText(grantedAuthority, "GrantedAuthority required");
|
||||
this.grantedAuthority = grantedAuthority;
|
||||
@@ -52,9 +46,6 @@ public class GrantedAuthoritySid implements Sid {
|
||||
this.grantedAuthority = grantedAuthority.getAuthority();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof GrantedAuthoritySid)) {
|
||||
|
||||
-3
@@ -22,9 +22,6 @@ package org.springframework.security.acls.domain;
|
||||
*/
|
||||
public class IdentityUnavailableException extends RuntimeException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs an <code>IdentityUnavailableException</code> with the specified message.
|
||||
* @param msg the detail message
|
||||
|
||||
@@ -32,16 +32,10 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class ObjectIdentityImpl implements ObjectIdentity {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final String type;
|
||||
|
||||
private Serializable identifier;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public ObjectIdentityImpl(String type, Serializable identifier) {
|
||||
Assert.hasText(type, "Type required");
|
||||
Assert.notNull(identifier, "identifier required");
|
||||
@@ -92,9 +86,6 @@ public class ObjectIdentityImpl implements ObjectIdentity {
|
||||
this.identifier = (Serializable) result;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Important so caching operates properly.
|
||||
* <p>
|
||||
|
||||
-3
@@ -31,9 +31,6 @@ import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;
|
||||
*/
|
||||
public class ObjectIdentityRetrievalStrategyImpl implements ObjectIdentityRetrievalStrategy, ObjectIdentityGenerator {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public ObjectIdentity getObjectIdentity(Object domainObject) {
|
||||
return new ObjectIdentityImpl(domainObject);
|
||||
}
|
||||
|
||||
@@ -32,14 +32,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class PrincipalSid implements Sid {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final String principal;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public PrincipalSid(String principal) {
|
||||
Assert.hasText(principal, "Principal required");
|
||||
this.principal = principal;
|
||||
@@ -52,9 +46,6 @@ public class PrincipalSid implements Sid {
|
||||
this.principal = authentication.getName();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof PrincipalSid)) {
|
||||
|
||||
-3
@@ -51,9 +51,6 @@ public class SidRetrievalStrategyImpl implements SidRetrievalStrategy {
|
||||
this.roleHierarchy = roleHierarchy;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public List<Sid> getSids(Authentication authentication) {
|
||||
Collection<? extends GrantedAuthority> authorities = roleHierarchy
|
||||
.getReachableGrantedAuthorities(authentication.getAuthorities());
|
||||
|
||||
-9
@@ -40,18 +40,12 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class SpringCacheBasedAclCache implements AclCache {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final Cache cache;
|
||||
|
||||
private PermissionGrantingStrategy permissionGrantingStrategy;
|
||||
|
||||
private AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public SpringCacheBasedAclCache(Cache cache, PermissionGrantingStrategy permissionGrantingStrategy,
|
||||
AclAuthorizationStrategy aclAuthorizationStrategy) {
|
||||
Assert.notNull(cache, "Cache required");
|
||||
@@ -62,9 +56,6 @@ public class SpringCacheBasedAclCache implements AclCache {
|
||||
this.aclAuthorizationStrategy = aclAuthorizationStrategy;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void evictFromCache(Serializable pk) {
|
||||
Assert.notNull(pk, "Primary key (identifier) required");
|
||||
|
||||
|
||||
@@ -105,9 +105,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||
public final static String DEFAULT_ORDER_BY_CLAUSE = ") order by acl_object_identity.object_id_identity"
|
||||
+ " asc, acl_entry.ace_order asc";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||
|
||||
private PermissionFactory permissionFactory = new DefaultPermissionFactory();
|
||||
@@ -135,9 +132,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||
|
||||
private AclClassIdUtils aclClassIdUtils;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructor accepting mandatory arguments
|
||||
* @param dataSource to access the database
|
||||
@@ -171,9 +165,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||
fieldAcl.setAccessible(true);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private String computeRepeatingSql(String repeatingSql, int requiredRepetitions) {
|
||||
assert requiredRepetitions > 0 : "requiredRepetitions must be > 0";
|
||||
|
||||
@@ -530,9 +521,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class ProcessResultSet implements ResultSetExtractor<Set<Long>> {
|
||||
|
||||
private final Map<Serializable, Acl> acls;
|
||||
|
||||
@@ -46,9 +46,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class JdbcAclService implements AclService {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log log = LogFactory.getLog(JdbcAclService.class);
|
||||
|
||||
private static final String DEFAULT_SELECT_ACL_CLASS_COLUMNS = "class.class as class";
|
||||
@@ -70,9 +67,6 @@ public class JdbcAclService implements AclService {
|
||||
+ "and parent.object_id_identity = ? and parent.object_id_class = ("
|
||||
+ "select id FROM acl_class where acl_class.class = ?)";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
protected final JdbcOperations jdbcOperations;
|
||||
|
||||
private final LookupStrategy lookupStrategy;
|
||||
@@ -83,9 +77,6 @@ public class JdbcAclService implements AclService {
|
||||
|
||||
private AclClassIdUtils aclClassIdUtils;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public JdbcAclService(DataSource dataSource, LookupStrategy lookupStrategy) {
|
||||
this(new JdbcTemplate(dataSource), lookupStrategy);
|
||||
}
|
||||
@@ -98,9 +89,6 @@ public class JdbcAclService implements AclService {
|
||||
this.aclClassIdUtils = new AclClassIdUtils();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) {
|
||||
Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() };
|
||||
List<ObjectIdentity> objects = jdbcOperations.query(findChildrenSql, args, (rs, rowNum) -> {
|
||||
|
||||
@@ -63,9 +63,6 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS
|
||||
|
||||
private static final String DEFAULT_INSERT_INTO_ACL_CLASS_WITH_ID = "insert into acl_class (class, class_id_type) values (?, ?)";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private boolean foreignKeysInDatabase = true;
|
||||
|
||||
private final AclCache aclCache;
|
||||
@@ -100,18 +97,12 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS
|
||||
private String updateObjectIdentity = "update acl_object_identity set "
|
||||
+ "parent_object = ?, owner_sid = ?, entries_inheriting = ?" + " where id = ?";
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public JdbcMutableAclService(DataSource dataSource, LookupStrategy lookupStrategy, AclCache aclCache) {
|
||||
super(dataSource, lookupStrategy);
|
||||
Assert.notNull(aclCache, "AclCache required");
|
||||
this.aclCache = aclCache;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public MutableAcl createAcl(ObjectIdentity objectIdentity) throws AlreadyExistsException {
|
||||
Assert.notNull(objectIdentity, "Object Identity required");
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface LookupStrategy {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Perform database-specific optimized lookup.
|
||||
* @param objects the identities to lookup (required)
|
||||
|
||||
@@ -30,9 +30,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface AccessControlEntry extends Serializable {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
Acl getAcl();
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,9 +27,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface AclCache {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
void evictFromCache(Serializable pk);
|
||||
|
||||
void evictFromCache(ObjectIdentity objectIdentity);
|
||||
|
||||
@@ -25,9 +25,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface AclService {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Locates all object identities that use the specified parent. This is useful for
|
||||
* administration tools.
|
||||
|
||||
@@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public class AlreadyExistsException extends AclDataAccessException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs an <code>AlreadyExistsException</code> with the specified message.
|
||||
* @param msg the detail message
|
||||
|
||||
-3
@@ -23,9 +23,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public interface AuditableAccessControlEntry extends AccessControlEntry {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
boolean isAuditFailure();
|
||||
|
||||
boolean isAuditSuccess();
|
||||
|
||||
@@ -23,9 +23,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public interface AuditableAcl extends MutableAcl {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
void updateAuditing(int aceIndex, boolean auditSuccess, boolean auditFailure);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public class ChildrenExistException extends AclDataAccessException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs an <code>ChildrenExistException</code> with the specified message.
|
||||
* @param msg the detail message
|
||||
|
||||
@@ -27,9 +27,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface MutableAcl extends Acl {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
void deleteAce(int aceIndex) throws NotFoundException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public interface MutableAclService extends AclService {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Creates an empty <code>Acl</code> object in the database. It will have no entries.
|
||||
* The returned object will then be used to add entries.
|
||||
|
||||
@@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public class NotFoundException extends AclDataAccessException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs an <code>NotFoundException</code> with the specified message.
|
||||
* @param msg the detail message
|
||||
|
||||
@@ -33,9 +33,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface ObjectIdentity extends Serializable {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* @param obj to be compared
|
||||
* @return <tt>true</tt> if the objects are equal, <tt>false</tt> otherwise
|
||||
|
||||
-3
@@ -25,9 +25,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public interface ObjectIdentityRetrievalStrategy {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
ObjectIdentity getObjectIdentity(Object domainObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public interface OwnershipAcl extends MutableAcl {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
void setOwner(Sid newOwner);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,18 +24,12 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface Permission extends Serializable {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
char RESERVED_ON = '~';
|
||||
|
||||
char RESERVED_OFF = '.';
|
||||
|
||||
String THIRTY_TWO_RESERVED_OFF = "................................";
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Returns the bits that represents the permission.
|
||||
* @return the bits that represent the permission
|
||||
|
||||
@@ -32,9 +32,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface Sid extends Serializable {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Refer to the <code>java.lang.Object</code> documentation for the interface
|
||||
* contract.
|
||||
|
||||
@@ -28,9 +28,6 @@ import org.springframework.security.core.Authentication;
|
||||
*/
|
||||
public interface SidRetrievalStrategy {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
List<Sid> getSids(Authentication authentication);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ package org.springframework.security.acls.model;
|
||||
*/
|
||||
public class UnloadedSidException extends AclDataAccessException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs an <code>NotFoundException</code> with the specified message.
|
||||
* @param msg the detail message
|
||||
|
||||
@@ -29,8 +29,6 @@ import org.springframework.security.acls.model.Permission;
|
||||
*/
|
||||
public class AclFormattingUtilsTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public final void testDemergePatternsParametersConstraints() {
|
||||
try {
|
||||
|
||||
-3
@@ -32,9 +32,6 @@ import org.springframework.security.acls.model.Sid;
|
||||
*/
|
||||
public class AccessControlImplEntryTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void testConstructorRequiredFields() {
|
||||
// Check Acl field is present
|
||||
|
||||
@@ -62,9 +62,6 @@ public class AclImplTests {
|
||||
|
||||
private DefaultPermissionFactory permissionFactory;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
@@ -540,9 +537,6 @@ public class AclImplTests {
|
||||
ace.hashCode();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private static class MaskPermissionGrantingStrategy extends DefaultPermissionGrantingStrategy {
|
||||
|
||||
MaskPermissionGrantingStrategy(AuditLogger auditLogger) {
|
||||
|
||||
-3
@@ -38,9 +38,6 @@ public class AclImplementationSecurityCheckTests {
|
||||
|
||||
private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject";
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
SecurityContextHolder.clearContext();
|
||||
|
||||
@@ -34,8 +34,6 @@ import org.springframework.security.acls.model.AuditableAccessControlEntry;
|
||||
*/
|
||||
public class AuditLoggerTests {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
private PrintStream console;
|
||||
|
||||
private ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
@@ -44,9 +42,6 @@ public class AuditLoggerTests {
|
||||
|
||||
private AuditableAccessControlEntry ace;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
logger = new ConsoleAuditLogger();
|
||||
|
||||
-6
@@ -32,9 +32,6 @@ public class ObjectIdentityImplTests {
|
||||
|
||||
private static final String DOMAIN_CLASS = "org.springframework.security.acls.domain.ObjectIdentityImplTests$MockIdDomainObject";
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void constructorsRespectRequiredFields() {
|
||||
// Check one-argument constructor required field
|
||||
@@ -177,9 +174,6 @@ public class ObjectIdentityImplTests {
|
||||
assertThat(obj).isNotEqualTo(obj2);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockIdDomainObject {
|
||||
|
||||
private Object id;
|
||||
|
||||
-4
@@ -28,8 +28,6 @@ import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;
|
||||
*/
|
||||
public class ObjectIdentityRetrievalStrategyImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testObjectIdentityCreation() {
|
||||
MockIdDomainObject domain = new MockIdDomainObject();
|
||||
@@ -42,8 +40,6 @@ public class ObjectIdentityRetrievalStrategyImplTests {
|
||||
assertThat(new ObjectIdentityImpl(domain)).isEqualTo(identity);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
@SuppressWarnings("unused")
|
||||
private class MockIdDomainObject {
|
||||
|
||||
|
||||
-6
@@ -56,16 +56,10 @@ public abstract class AbstractBasicLookupStrategyTests {
|
||||
|
||||
protected static final Long OBJECT_IDENTITY_LONG_AS_UUID = 110L;
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private BasicLookupStrategy strategy;
|
||||
|
||||
private static CacheManager cacheManager;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public abstract JdbcTemplate getJdbcTemplate();
|
||||
|
||||
public abstract DataSource getDataSource();
|
||||
|
||||
@@ -33,9 +33,6 @@ import javax.sql.DataSource;
|
||||
*/
|
||||
public class DatabaseSeeder {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public DatabaseSeeder(DataSource dataSource, Resource resource) throws IOException {
|
||||
Assert.notNull(dataSource, "dataSource required");
|
||||
Assert.notNull(resource, "resource required");
|
||||
|
||||
@@ -112,9 +112,6 @@ public class JdbcAclServiceTests {
|
||||
assertThat(objectIdentities).isNull();
|
||||
}
|
||||
|
||||
// ~ Some integration tests
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void findChildrenWithoutIdType() {
|
||||
ObjectIdentity objectIdentity = new ObjectIdentityImpl(MockLongIdDomainObject.class, 4711L);
|
||||
|
||||
-9
@@ -64,18 +64,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@ContextConfiguration(locations = { "/jdbcMutableAclServiceTests-context.xml" })
|
||||
public class JdbcMutableAclServiceTests extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
|
||||
// ~ Constant fields
|
||||
// ================================================================================================
|
||||
|
||||
private static final String TARGET_CLASS = TargetObject.class.getName();
|
||||
|
||||
private final Authentication auth = new TestingAuthenticationToken("ben", "ignored", "ROLE_ADMINISTRATOR");
|
||||
|
||||
public static final String SELECT_ALL_CLASSES = "SELECT * FROM acl_class WHERE class = ?";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, 100L);
|
||||
|
||||
private final ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101L);
|
||||
@@ -97,9 +91,6 @@ public class JdbcMutableAclServiceTests extends AbstractTransactionalJUnit4Sprin
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
protected String getSqlClassPathResource() {
|
||||
return "createAclSchema.sql";
|
||||
}
|
||||
|
||||
@@ -42,9 +42,6 @@ public class SidRetrievalStrategyTests {
|
||||
|
||||
Authentication authentication = new TestingAuthenticationToken("scott", "password", "A", "B", "C");
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void correctSidsAreRetrieved() {
|
||||
SidRetrievalStrategy retrStrategy = new SidRetrievalStrategyImpl();
|
||||
|
||||
@@ -34,8 +34,6 @@ import java.util.Collections;
|
||||
|
||||
public class SidTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testPrincipalSidConstructorsRequiredFields() {
|
||||
// Check one String-argument constructor
|
||||
|
||||
Reference in New Issue
Block a user