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:
parent
b7fc18262d
commit
71bc145ae4
|
|
@ -96,14 +96,8 @@ import org.springframework.util.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class AclEntryVoter extends AbstractAclVoter {
|
public class AclEntryVoter extends AbstractAclVoter {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(AclEntryVoter.class);
|
private static final Log logger = LogFactory.getLog(AclEntryVoter.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private AclService aclService;
|
private AclService aclService;
|
||||||
|
|
||||||
private ObjectIdentityRetrievalStrategy objectIdentityRetrievalStrategy = new ObjectIdentityRetrievalStrategyImpl();
|
private ObjectIdentityRetrievalStrategy objectIdentityRetrievalStrategy = new ObjectIdentityRetrievalStrategyImpl();
|
||||||
|
|
@ -116,9 +110,6 @@ public class AclEntryVoter extends AbstractAclVoter {
|
||||||
|
|
||||||
private List<Permission> requirePermission;
|
private List<Permission> requirePermission;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public AclEntryVoter(AclService aclService, String processConfigAttribute, Permission[] requirePermission) {
|
public AclEntryVoter(AclService aclService, String processConfigAttribute, Permission[] requirePermission) {
|
||||||
Assert.notNull(processConfigAttribute, "A processConfigAttribute is mandatory");
|
Assert.notNull(processConfigAttribute, "A processConfigAttribute is mandatory");
|
||||||
Assert.notNull(aclService, "An AclService is mandatory");
|
Assert.notNull(aclService, "An AclService is mandatory");
|
||||||
|
|
@ -132,9 +123,6 @@ public class AclEntryVoter extends AbstractAclVoter {
|
||||||
this.requirePermission = Arrays.asList(requirePermission);
|
this.requirePermission = Arrays.asList(requirePermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optionally specifies a method of the domain object that will be used to obtain a
|
* 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
|
* contained domain object. That contained domain object will be used for the ACL
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
protected final AclService aclService;
|
protected final AclService aclService;
|
||||||
|
|
||||||
protected Class<?> processDomainObjectClass = Object.class;
|
protected Class<?> processDomainObjectClass = Object.class;
|
||||||
|
|
@ -56,9 +53,6 @@ public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
||||||
|
|
||||||
protected final List<Permission> requirePermission;
|
protected final List<Permission> requirePermission;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public AbstractAclProvider(AclService aclService, String processConfigAttribute,
|
public AbstractAclProvider(AclService aclService, String processConfigAttribute,
|
||||||
List<Permission> requirePermission) {
|
List<Permission> requirePermission) {
|
||||||
Assert.hasText(processConfigAttribute, "A processConfigAttribute is mandatory");
|
Assert.hasText(processConfigAttribute, "A processConfigAttribute is mandatory");
|
||||||
|
|
@ -73,9 +67,6 @@ public abstract class AbstractAclProvider implements AfterInvocationProvider {
|
||||||
this.requirePermission = requirePermission;
|
this.requirePermission = requirePermission;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
protected Class<?> getProcessDomainObjectClass() {
|
protected Class<?> getProcessDomainObjectClass() {
|
||||||
return processDomainObjectClass;
|
return processDomainObjectClass;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,22 +62,13 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public class AclEntryAfterInvocationCollectionFilteringProvider extends AbstractAclProvider {
|
public class AclEntryAfterInvocationCollectionFilteringProvider extends AbstractAclProvider {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log logger = LogFactory.getLog(AclEntryAfterInvocationCollectionFilteringProvider.class);
|
protected static final Log logger = LogFactory.getLog(AclEntryAfterInvocationCollectionFilteringProvider.class);
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public AclEntryAfterInvocationCollectionFilteringProvider(AclService aclService,
|
public AclEntryAfterInvocationCollectionFilteringProvider(AclService aclService,
|
||||||
List<Permission> requirePermission) {
|
List<Permission> requirePermission) {
|
||||||
super(aclService, "AFTER_ACL_COLLECTION_READ", requirePermission);
|
super(aclService, "AFTER_ACL_COLLECTION_READ", requirePermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config,
|
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config,
|
||||||
Object returnedObject) throws AccessDeniedException {
|
Object returnedObject) throws AccessDeniedException {
|
||||||
|
|
|
||||||
|
|
@ -60,19 +60,10 @@ import org.springframework.security.core.SpringSecurityMessageSource;
|
||||||
*/
|
*/
|
||||||
public class AclEntryAfterInvocationProvider extends AbstractAclProvider implements MessageSourceAware {
|
public class AclEntryAfterInvocationProvider extends AbstractAclProvider implements MessageSourceAware {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log logger = LogFactory.getLog(AclEntryAfterInvocationProvider.class);
|
protected static final Log logger = LogFactory.getLog(AclEntryAfterInvocationProvider.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public AclEntryAfterInvocationProvider(AclService aclService, List<Permission> requirePermission) {
|
public AclEntryAfterInvocationProvider(AclService aclService, List<Permission> requirePermission) {
|
||||||
this(aclService, "AFTER_ACL_READ", requirePermission);
|
this(aclService, "AFTER_ACL_READ", requirePermission);
|
||||||
}
|
}
|
||||||
|
|
@ -82,9 +73,6 @@ public class AclEntryAfterInvocationProvider extends AbstractAclProvider impleme
|
||||||
super(aclService, processConfigAttribute, requirePermission);
|
super(aclService, processConfigAttribute, requirePermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config,
|
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config,
|
||||||
Object returnedObject) throws AccessDeniedException {
|
Object returnedObject) throws AccessDeniedException {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,21 +33,12 @@ import org.apache.commons.logging.LogFactory;
|
||||||
*/
|
*/
|
||||||
class ArrayFilterer<T> implements Filterer<T> {
|
class ArrayFilterer<T> implements Filterer<T> {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log logger = LogFactory.getLog(ArrayFilterer.class);
|
protected static final Log logger = LogFactory.getLog(ArrayFilterer.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Set<T> removeList;
|
private final Set<T> removeList;
|
||||||
|
|
||||||
private final T[] list;
|
private final T[] list;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
ArrayFilterer(T[] list) {
|
ArrayFilterer(T[] list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
|
|
||||||
|
|
@ -57,9 +48,6 @@ class ArrayFilterer<T> implements Filterer<T> {
|
||||||
removeList = new HashSet<>();
|
removeList = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see org.springframework.security.acls.afterinvocation.Filterer#getFilteredObject()
|
* @see org.springframework.security.acls.afterinvocation.Filterer#getFilteredObject()
|
||||||
|
|
|
||||||
|
|
@ -32,21 +32,12 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
class CollectionFilterer<T> implements Filterer<T> {
|
class CollectionFilterer<T> implements Filterer<T> {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log logger = LogFactory.getLog(CollectionFilterer.class);
|
protected static final Log logger = LogFactory.getLog(CollectionFilterer.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Collection<T> collection;
|
private final Collection<T> collection;
|
||||||
|
|
||||||
private final Set<T> removeList;
|
private final Set<T> removeList;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
CollectionFilterer(Collection<T> collection) {
|
CollectionFilterer(Collection<T> collection) {
|
||||||
this.collection = collection;
|
this.collection = collection;
|
||||||
|
|
||||||
|
|
@ -60,9 +51,6 @@ class CollectionFilterer<T> implements Filterer<T> {
|
||||||
removeList = new HashSet<>();
|
removeList = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see org.springframework.security.acls.afterinvocation.Filterer#getFilteredObject()
|
* @see org.springframework.security.acls.afterinvocation.Filterer#getFilteredObject()
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@ import java.util.Iterator;
|
||||||
*/
|
*/
|
||||||
interface Filterer<T> extends Iterable<T> {
|
interface Filterer<T> extends Iterable<T> {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the filtered collection or array.
|
* Gets the filtered collection or array.
|
||||||
* @return 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 {
|
public abstract class AbstractPermission implements Permission {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
protected final char code;
|
protected final char code;
|
||||||
|
|
||||||
protected int mask;
|
protected int mask;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
/**
|
/**
|
||||||
* Sets the permission mask and uses the '*' character to represent active bits when
|
* Sets the permission mask and uses the '*' character to represent active bits when
|
||||||
* represented as a bit pattern string.
|
* represented as a bit pattern string.
|
||||||
|
|
@ -55,9 +50,6 @@ public abstract class AbstractPermission implements Permission {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public final boolean equals(Object arg0) {
|
public final boolean equals(Object arg0) {
|
||||||
if (arg0 == null) {
|
if (arg0 == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public class AccessControlEntryImpl implements AccessControlEntry, AuditableAccessControlEntry {
|
public class AccessControlEntryImpl implements AccessControlEntry, AuditableAccessControlEntry {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Acl acl;
|
private final Acl acl;
|
||||||
|
|
||||||
private Permission permission;
|
private Permission permission;
|
||||||
|
|
@ -49,9 +46,6 @@ public class AccessControlEntryImpl implements AccessControlEntry, AuditableAcce
|
||||||
|
|
||||||
private final boolean granting;
|
private final boolean granting;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public AccessControlEntryImpl(Serializable id, Acl acl, Sid sid, Permission permission, boolean granting,
|
public AccessControlEntryImpl(Serializable id, Acl acl, Sid sid, Permission permission, boolean granting,
|
||||||
boolean auditSuccess, boolean auditFailure) {
|
boolean auditSuccess, boolean auditFailure) {
|
||||||
Assert.notNull(acl, "Acl required");
|
Assert.notNull(acl, "Acl required");
|
||||||
|
|
@ -66,9 +60,6 @@ public class AccessControlEntryImpl implements AccessControlEntry, AuditableAcce
|
||||||
this.auditFailure = auditFailure;
|
this.auditFailure = auditFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object arg0) {
|
public boolean equals(Object arg0) {
|
||||||
if (!(arg0 instanceof AccessControlEntryImpl)) {
|
if (!(arg0 instanceof AccessControlEntryImpl)) {
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,12 @@ import org.springframework.security.acls.model.Acl;
|
||||||
*/
|
*/
|
||||||
public interface AclAuthorizationStrategy {
|
public interface AclAuthorizationStrategy {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
int CHANGE_OWNERSHIP = 0;
|
int CHANGE_OWNERSHIP = 0;
|
||||||
|
|
||||||
int CHANGE_AUDITING = 1;
|
int CHANGE_AUDITING = 1;
|
||||||
|
|
||||||
int CHANGE_GENERAL = 2;
|
int CHANGE_GENERAL = 2;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
void securityCheck(Acl acl, int changeType);
|
void securityCheck(Acl acl, int changeType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,6 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class AclAuthorizationStrategyImpl implements AclAuthorizationStrategy {
|
public class AclAuthorizationStrategyImpl implements AclAuthorizationStrategy {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final GrantedAuthority gaGeneralChanges;
|
private final GrantedAuthority gaGeneralChanges;
|
||||||
|
|
||||||
private final GrantedAuthority gaModifyAuditing;
|
private final GrantedAuthority gaModifyAuditing;
|
||||||
|
|
@ -57,9 +54,6 @@ public class AclAuthorizationStrategyImpl implements AclAuthorizationStrategy {
|
||||||
|
|
||||||
private SidRetrievalStrategy sidRetrievalStrategy = new SidRetrievalStrategyImpl();
|
private SidRetrievalStrategy sidRetrievalStrategy = new SidRetrievalStrategyImpl();
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. The only mandatory parameter relates to the system-wide
|
* Constructor. The only mandatory parameter relates to the system-wide
|
||||||
* {@link GrantedAuthority} instances that can be held to always permit ACL changes.
|
* {@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) {
|
public void securityCheck(Acl acl, int changeType) {
|
||||||
if ((SecurityContextHolder.getContext() == null)
|
if ((SecurityContextHolder.getContext() == null)
|
||||||
|| (SecurityContextHolder.getContext().getAuthentication() == null)
|
|| (SecurityContextHolder.getContext().getAuthentication() == null)
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private Acl parentAcl;
|
private Acl parentAcl;
|
||||||
|
|
||||||
private transient AclAuthorizationStrategy aclAuthorizationStrategy;
|
private transient AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||||
|
|
@ -61,9 +58,6 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
||||||
|
|
||||||
private boolean entriesInheriting = true;
|
private boolean entriesInheriting = true;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal constructor, which should be used
|
* Minimal constructor, which should be used
|
||||||
* {@link org.springframework.security.acls.model.MutableAclService#createAcl(ObjectIdentity)}
|
* {@link org.springframework.security.acls.model.MutableAclService#createAcl(ObjectIdentity)}
|
||||||
|
|
@ -125,9 +119,6 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
|
||||||
private AclImpl() {
|
private AclImpl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAce(int aceIndex) throws NotFoundException {
|
public void deleteAce(int aceIndex) throws NotFoundException {
|
||||||
aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
|
aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ import org.springframework.security.acls.model.AccessControlEntry;
|
||||||
*/
|
*/
|
||||||
public interface AuditLogger {
|
public interface AuditLogger {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
void logIfNeeded(boolean granted, AccessControlEntry ace);
|
void logIfNeeded(boolean granted, AccessControlEntry ace);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class ConsoleAuditLogger implements AuditLogger {
|
public class ConsoleAuditLogger implements AuditLogger {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void logIfNeeded(boolean granted, AccessControlEntry ace) {
|
public void logIfNeeded(boolean granted, AccessControlEntry ace) {
|
||||||
Assert.notNull(ace, "AccessControlEntry required");
|
Assert.notNull(ace, "AccessControlEntry required");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,18 +39,12 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class EhCacheBasedAclCache implements AclCache {
|
public class EhCacheBasedAclCache implements AclCache {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Ehcache cache;
|
private final Ehcache cache;
|
||||||
|
|
||||||
private PermissionGrantingStrategy permissionGrantingStrategy;
|
private PermissionGrantingStrategy permissionGrantingStrategy;
|
||||||
|
|
||||||
private AclAuthorizationStrategy aclAuthorizationStrategy;
|
private AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public EhCacheBasedAclCache(Ehcache cache, PermissionGrantingStrategy permissionGrantingStrategy,
|
public EhCacheBasedAclCache(Ehcache cache, PermissionGrantingStrategy permissionGrantingStrategy,
|
||||||
AclAuthorizationStrategy aclAuthorizationStrategy) {
|
AclAuthorizationStrategy aclAuthorizationStrategy) {
|
||||||
Assert.notNull(cache, "Cache required");
|
Assert.notNull(cache, "Cache required");
|
||||||
|
|
@ -61,9 +55,6 @@ public class EhCacheBasedAclCache implements AclCache {
|
||||||
this.aclAuthorizationStrategy = aclAuthorizationStrategy;
|
this.aclAuthorizationStrategy = aclAuthorizationStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void evictFromCache(Serializable pk) {
|
public void evictFromCache(Serializable pk) {
|
||||||
Assert.notNull(pk, "Primary key (identifier) required");
|
Assert.notNull(pk, "Primary key (identifier) required");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,8 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class GrantedAuthoritySid implements Sid {
|
public class GrantedAuthoritySid implements Sid {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final String grantedAuthority;
|
private final String grantedAuthority;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public GrantedAuthoritySid(String grantedAuthority) {
|
public GrantedAuthoritySid(String grantedAuthority) {
|
||||||
Assert.hasText(grantedAuthority, "GrantedAuthority required");
|
Assert.hasText(grantedAuthority, "GrantedAuthority required");
|
||||||
this.grantedAuthority = grantedAuthority;
|
this.grantedAuthority = grantedAuthority;
|
||||||
|
|
@ -52,9 +46,6 @@ public class GrantedAuthoritySid implements Sid {
|
||||||
this.grantedAuthority = grantedAuthority.getAuthority();
|
this.grantedAuthority = grantedAuthority.getAuthority();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object == null) || !(object instanceof GrantedAuthoritySid)) {
|
if ((object == null) || !(object instanceof GrantedAuthoritySid)) {
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@ package org.springframework.security.acls.domain;
|
||||||
*/
|
*/
|
||||||
public class IdentityUnavailableException extends RuntimeException {
|
public class IdentityUnavailableException extends RuntimeException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>IdentityUnavailableException</code> with the specified message.
|
* Constructs an <code>IdentityUnavailableException</code> with the specified message.
|
||||||
* @param msg the detail message
|
* @param msg the detail message
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,10 @@ import org.springframework.util.ClassUtils;
|
||||||
*/
|
*/
|
||||||
public class ObjectIdentityImpl implements ObjectIdentity {
|
public class ObjectIdentityImpl implements ObjectIdentity {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
private Serializable identifier;
|
private Serializable identifier;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public ObjectIdentityImpl(String type, Serializable identifier) {
|
public ObjectIdentityImpl(String type, Serializable identifier) {
|
||||||
Assert.hasText(type, "Type required");
|
Assert.hasText(type, "Type required");
|
||||||
Assert.notNull(identifier, "identifier required");
|
Assert.notNull(identifier, "identifier required");
|
||||||
|
|
@ -92,9 +86,6 @@ public class ObjectIdentityImpl implements ObjectIdentity {
|
||||||
this.identifier = (Serializable) result;
|
this.identifier = (Serializable) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Important so caching operates properly.
|
* Important so caching operates properly.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,6 @@ import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;
|
||||||
*/
|
*/
|
||||||
public class ObjectIdentityRetrievalStrategyImpl implements ObjectIdentityRetrievalStrategy, ObjectIdentityGenerator {
|
public class ObjectIdentityRetrievalStrategyImpl implements ObjectIdentityRetrievalStrategy, ObjectIdentityGenerator {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public ObjectIdentity getObjectIdentity(Object domainObject) {
|
public ObjectIdentity getObjectIdentity(Object domainObject) {
|
||||||
return new ObjectIdentityImpl(domainObject);
|
return new ObjectIdentityImpl(domainObject);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,8 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class PrincipalSid implements Sid {
|
public class PrincipalSid implements Sid {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final String principal;
|
private final String principal;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public PrincipalSid(String principal) {
|
public PrincipalSid(String principal) {
|
||||||
Assert.hasText(principal, "Principal required");
|
Assert.hasText(principal, "Principal required");
|
||||||
this.principal = principal;
|
this.principal = principal;
|
||||||
|
|
@ -52,9 +46,6 @@ public class PrincipalSid implements Sid {
|
||||||
this.principal = authentication.getName();
|
this.principal = authentication.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object == null) || !(object instanceof PrincipalSid)) {
|
if ((object == null) || !(object instanceof PrincipalSid)) {
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,6 @@ public class SidRetrievalStrategyImpl implements SidRetrievalStrategy {
|
||||||
this.roleHierarchy = roleHierarchy;
|
this.roleHierarchy = roleHierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public List<Sid> getSids(Authentication authentication) {
|
public List<Sid> getSids(Authentication authentication) {
|
||||||
Collection<? extends GrantedAuthority> authorities = roleHierarchy
|
Collection<? extends GrantedAuthority> authorities = roleHierarchy
|
||||||
.getReachableGrantedAuthorities(authentication.getAuthorities());
|
.getReachableGrantedAuthorities(authentication.getAuthorities());
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,12 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public class SpringCacheBasedAclCache implements AclCache {
|
public class SpringCacheBasedAclCache implements AclCache {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Cache cache;
|
private final Cache cache;
|
||||||
|
|
||||||
private PermissionGrantingStrategy permissionGrantingStrategy;
|
private PermissionGrantingStrategy permissionGrantingStrategy;
|
||||||
|
|
||||||
private AclAuthorizationStrategy aclAuthorizationStrategy;
|
private AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public SpringCacheBasedAclCache(Cache cache, PermissionGrantingStrategy permissionGrantingStrategy,
|
public SpringCacheBasedAclCache(Cache cache, PermissionGrantingStrategy permissionGrantingStrategy,
|
||||||
AclAuthorizationStrategy aclAuthorizationStrategy) {
|
AclAuthorizationStrategy aclAuthorizationStrategy) {
|
||||||
Assert.notNull(cache, "Cache required");
|
Assert.notNull(cache, "Cache required");
|
||||||
|
|
@ -62,9 +56,6 @@ public class SpringCacheBasedAclCache implements AclCache {
|
||||||
this.aclAuthorizationStrategy = aclAuthorizationStrategy;
|
this.aclAuthorizationStrategy = aclAuthorizationStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void evictFromCache(Serializable pk) {
|
public void evictFromCache(Serializable pk) {
|
||||||
Assert.notNull(pk, "Primary key (identifier) required");
|
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"
|
public final static String DEFAULT_ORDER_BY_CLAUSE = ") order by acl_object_identity.object_id_identity"
|
||||||
+ " asc, acl_entry.ace_order asc";
|
+ " asc, acl_entry.ace_order asc";
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final AclAuthorizationStrategy aclAuthorizationStrategy;
|
private final AclAuthorizationStrategy aclAuthorizationStrategy;
|
||||||
|
|
||||||
private PermissionFactory permissionFactory = new DefaultPermissionFactory();
|
private PermissionFactory permissionFactory = new DefaultPermissionFactory();
|
||||||
|
|
@ -135,9 +132,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||||
|
|
||||||
private AclClassIdUtils aclClassIdUtils;
|
private AclClassIdUtils aclClassIdUtils;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor accepting mandatory arguments
|
* Constructor accepting mandatory arguments
|
||||||
* @param dataSource to access the database
|
* @param dataSource to access the database
|
||||||
|
|
@ -171,9 +165,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||||
fieldAcl.setAccessible(true);
|
fieldAcl.setAccessible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
private String computeRepeatingSql(String repeatingSql, int requiredRepetitions) {
|
private String computeRepeatingSql(String repeatingSql, int requiredRepetitions) {
|
||||||
assert requiredRepetitions > 0 : "requiredRepetitions must be > 0";
|
assert requiredRepetitions > 0 : "requiredRepetitions must be > 0";
|
||||||
|
|
||||||
|
|
@ -530,9 +521,6 @@ public class BasicLookupStrategy implements LookupStrategy {
|
||||||
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
this.aclClassIdUtils = new AclClassIdUtils(conversionService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
|
||||||
// ==================================================================================================
|
|
||||||
|
|
||||||
private class ProcessResultSet implements ResultSetExtractor<Set<Long>> {
|
private class ProcessResultSet implements ResultSetExtractor<Set<Long>> {
|
||||||
|
|
||||||
private final Map<Serializable, Acl> acls;
|
private final Map<Serializable, Acl> acls;
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class JdbcAclService implements AclService {
|
public class JdbcAclService implements AclService {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log log = LogFactory.getLog(JdbcAclService.class);
|
protected static final Log log = LogFactory.getLog(JdbcAclService.class);
|
||||||
|
|
||||||
private static final String DEFAULT_SELECT_ACL_CLASS_COLUMNS = "class.class as 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 = ("
|
+ "and parent.object_id_identity = ? and parent.object_id_class = ("
|
||||||
+ "select id FROM acl_class where acl_class.class = ?)";
|
+ "select id FROM acl_class where acl_class.class = ?)";
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
protected final JdbcOperations jdbcOperations;
|
protected final JdbcOperations jdbcOperations;
|
||||||
|
|
||||||
private final LookupStrategy lookupStrategy;
|
private final LookupStrategy lookupStrategy;
|
||||||
|
|
@ -83,9 +77,6 @@ public class JdbcAclService implements AclService {
|
||||||
|
|
||||||
private AclClassIdUtils aclClassIdUtils;
|
private AclClassIdUtils aclClassIdUtils;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public JdbcAclService(DataSource dataSource, LookupStrategy lookupStrategy) {
|
public JdbcAclService(DataSource dataSource, LookupStrategy lookupStrategy) {
|
||||||
this(new JdbcTemplate(dataSource), lookupStrategy);
|
this(new JdbcTemplate(dataSource), lookupStrategy);
|
||||||
}
|
}
|
||||||
|
|
@ -98,9 +89,6 @@ public class JdbcAclService implements AclService {
|
||||||
this.aclClassIdUtils = new AclClassIdUtils();
|
this.aclClassIdUtils = new AclClassIdUtils();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) {
|
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) {
|
||||||
Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() };
|
Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() };
|
||||||
List<ObjectIdentity> objects = jdbcOperations.query(findChildrenSql, args, (rs, rowNum) -> {
|
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 (?, ?)";
|
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 boolean foreignKeysInDatabase = true;
|
||||||
|
|
||||||
private final AclCache aclCache;
|
private final AclCache aclCache;
|
||||||
|
|
@ -100,18 +97,12 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS
|
||||||
private String updateObjectIdentity = "update acl_object_identity set "
|
private String updateObjectIdentity = "update acl_object_identity set "
|
||||||
+ "parent_object = ?, owner_sid = ?, entries_inheriting = ?" + " where id = ?";
|
+ "parent_object = ?, owner_sid = ?, entries_inheriting = ?" + " where id = ?";
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public JdbcMutableAclService(DataSource dataSource, LookupStrategy lookupStrategy, AclCache aclCache) {
|
public JdbcMutableAclService(DataSource dataSource, LookupStrategy lookupStrategy, AclCache aclCache) {
|
||||||
super(dataSource, lookupStrategy);
|
super(dataSource, lookupStrategy);
|
||||||
Assert.notNull(aclCache, "AclCache required");
|
Assert.notNull(aclCache, "AclCache required");
|
||||||
this.aclCache = aclCache;
|
this.aclCache = aclCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public MutableAcl createAcl(ObjectIdentity objectIdentity) throws AlreadyExistsException {
|
public MutableAcl createAcl(ObjectIdentity objectIdentity) throws AlreadyExistsException {
|
||||||
Assert.notNull(objectIdentity, "Object Identity required");
|
Assert.notNull(objectIdentity, "Object Identity required");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface LookupStrategy {
|
public interface LookupStrategy {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform database-specific optimized lookup.
|
* Perform database-specific optimized lookup.
|
||||||
* @param objects the identities to lookup (required)
|
* @param objects the identities to lookup (required)
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public interface AccessControlEntry extends Serializable {
|
public interface AccessControlEntry extends Serializable {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
Acl getAcl();
|
Acl getAcl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public interface AclCache {
|
public interface AclCache {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
void evictFromCache(Serializable pk);
|
void evictFromCache(Serializable pk);
|
||||||
|
|
||||||
void evictFromCache(ObjectIdentity objectIdentity);
|
void evictFromCache(ObjectIdentity objectIdentity);
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface AclService {
|
public interface AclService {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locates all object identities that use the specified parent. This is useful for
|
* Locates all object identities that use the specified parent. This is useful for
|
||||||
* administration tools.
|
* administration tools.
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public class AlreadyExistsException extends AclDataAccessException {
|
public class AlreadyExistsException extends AclDataAccessException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>AlreadyExistsException</code> with the specified message.
|
* Constructs an <code>AlreadyExistsException</code> with the specified message.
|
||||||
* @param msg the detail message
|
* @param msg the detail message
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public interface AuditableAccessControlEntry extends AccessControlEntry {
|
public interface AuditableAccessControlEntry extends AccessControlEntry {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
boolean isAuditFailure();
|
boolean isAuditFailure();
|
||||||
|
|
||||||
boolean isAuditSuccess();
|
boolean isAuditSuccess();
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public interface AuditableAcl extends MutableAcl {
|
public interface AuditableAcl extends MutableAcl {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
void updateAuditing(int aceIndex, boolean auditSuccess, boolean auditFailure);
|
void updateAuditing(int aceIndex, boolean auditSuccess, boolean auditFailure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public class ChildrenExistException extends AclDataAccessException {
|
public class ChildrenExistException extends AclDataAccessException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>ChildrenExistException</code> with the specified message.
|
* Constructs an <code>ChildrenExistException</code> with the specified message.
|
||||||
* @param msg the detail message
|
* @param msg the detail message
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public interface MutableAcl extends Acl {
|
public interface MutableAcl extends Acl {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
void deleteAce(int aceIndex) throws NotFoundException;
|
void deleteAce(int aceIndex) throws NotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public interface MutableAclService extends AclService {
|
public interface MutableAclService extends AclService {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty <code>Acl</code> object in the database. It will have no entries.
|
* 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.
|
* 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 {
|
public class NotFoundException extends AclDataAccessException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>NotFoundException</code> with the specified message.
|
* Constructs an <code>NotFoundException</code> with the specified message.
|
||||||
* @param msg the detail message
|
* @param msg the detail message
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public interface ObjectIdentity extends Serializable {
|
public interface ObjectIdentity extends Serializable {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param obj to be compared
|
* @param obj to be compared
|
||||||
* @return <tt>true</tt> if the objects are equal, <tt>false</tt> otherwise
|
* @return <tt>true</tt> if the objects are equal, <tt>false</tt> otherwise
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public interface ObjectIdentityRetrievalStrategy {
|
public interface ObjectIdentityRetrievalStrategy {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
ObjectIdentity getObjectIdentity(Object domainObject);
|
ObjectIdentity getObjectIdentity(Object domainObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public interface OwnershipAcl extends MutableAcl {
|
public interface OwnershipAcl extends MutableAcl {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
void setOwner(Sid newOwner);
|
void setOwner(Sid newOwner);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,12 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public interface Permission extends Serializable {
|
public interface Permission extends Serializable {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
char RESERVED_ON = '~';
|
char RESERVED_ON = '~';
|
||||||
|
|
||||||
char RESERVED_OFF = '.';
|
char RESERVED_OFF = '.';
|
||||||
|
|
||||||
String THIRTY_TWO_RESERVED_OFF = "................................";
|
String THIRTY_TWO_RESERVED_OFF = "................................";
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bits that represents the permission.
|
* Returns the bits that represents the permission.
|
||||||
* @return the bits that represent the permission
|
* @return the bits that represent the permission
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public interface Sid extends Serializable {
|
public interface Sid extends Serializable {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refer to the <code>java.lang.Object</code> documentation for the interface
|
* Refer to the <code>java.lang.Object</code> documentation for the interface
|
||||||
* contract.
|
* contract.
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public interface SidRetrievalStrategy {
|
public interface SidRetrievalStrategy {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
List<Sid> getSids(Authentication authentication);
|
List<Sid> getSids(Authentication authentication);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,6 @@ package org.springframework.security.acls.model;
|
||||||
*/
|
*/
|
||||||
public class UnloadedSidException extends AclDataAccessException {
|
public class UnloadedSidException extends AclDataAccessException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>NotFoundException</code> with the specified message.
|
* Constructs an <code>NotFoundException</code> with the specified message.
|
||||||
* @param msg the detail message
|
* @param msg the detail message
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ import org.springframework.security.acls.model.Permission;
|
||||||
*/
|
*/
|
||||||
public class AclFormattingUtilsTests {
|
public class AclFormattingUtilsTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
@Test
|
@Test
|
||||||
public final void testDemergePatternsParametersConstraints() {
|
public final void testDemergePatternsParametersConstraints() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ import org.springframework.security.acls.model.Sid;
|
||||||
*/
|
*/
|
||||||
public class AccessControlImplEntryTests {
|
public class AccessControlImplEntryTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConstructorRequiredFields() {
|
public void testConstructorRequiredFields() {
|
||||||
// Check Acl field is present
|
// Check Acl field is present
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,6 @@ public class AclImplTests {
|
||||||
|
|
||||||
private DefaultPermissionFactory permissionFactory;
|
private DefaultPermissionFactory permissionFactory;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||||
|
|
@ -540,9 +537,6 @@ public class AclImplTests {
|
||||||
ace.hashCode();
|
ace.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
|
||||||
// ==================================================================================================
|
|
||||||
|
|
||||||
private static class MaskPermissionGrantingStrategy extends DefaultPermissionGrantingStrategy {
|
private static class MaskPermissionGrantingStrategy extends DefaultPermissionGrantingStrategy {
|
||||||
|
|
||||||
MaskPermissionGrantingStrategy(AuditLogger auditLogger) {
|
MaskPermissionGrantingStrategy(AuditLogger auditLogger) {
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,6 @@ public class AclImplementationSecurityCheckTests {
|
||||||
|
|
||||||
private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject";
|
private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject";
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
SecurityContextHolder.clearContext();
|
SecurityContextHolder.clearContext();
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ import org.springframework.security.acls.model.AuditableAccessControlEntry;
|
||||||
*/
|
*/
|
||||||
public class AuditLoggerTests {
|
public class AuditLoggerTests {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
private PrintStream console;
|
private PrintStream console;
|
||||||
|
|
||||||
private ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
private ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||||
|
|
@ -44,9 +42,6 @@ public class AuditLoggerTests {
|
||||||
|
|
||||||
private AuditableAccessControlEntry ace;
|
private AuditableAccessControlEntry ace;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
logger = new ConsoleAuditLogger();
|
logger = new ConsoleAuditLogger();
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ public class ObjectIdentityImplTests {
|
||||||
|
|
||||||
private static final String DOMAIN_CLASS = "org.springframework.security.acls.domain.ObjectIdentityImplTests$MockIdDomainObject";
|
private static final String DOMAIN_CLASS = "org.springframework.security.acls.domain.ObjectIdentityImplTests$MockIdDomainObject";
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void constructorsRespectRequiredFields() {
|
public void constructorsRespectRequiredFields() {
|
||||||
// Check one-argument constructor required field
|
// Check one-argument constructor required field
|
||||||
|
|
@ -177,9 +174,6 @@ public class ObjectIdentityImplTests {
|
||||||
assertThat(obj).isNotEqualTo(obj2);
|
assertThat(obj).isNotEqualTo(obj2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
|
||||||
// ==================================================================================================
|
|
||||||
|
|
||||||
private class MockIdDomainObject {
|
private class MockIdDomainObject {
|
||||||
|
|
||||||
private Object id;
|
private Object id;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;
|
||||||
*/
|
*/
|
||||||
public class ObjectIdentityRetrievalStrategyImplTests {
|
public class ObjectIdentityRetrievalStrategyImplTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
@Test
|
@Test
|
||||||
public void testObjectIdentityCreation() {
|
public void testObjectIdentityCreation() {
|
||||||
MockIdDomainObject domain = new MockIdDomainObject();
|
MockIdDomainObject domain = new MockIdDomainObject();
|
||||||
|
|
@ -42,8 +40,6 @@ public class ObjectIdentityRetrievalStrategyImplTests {
|
||||||
assertThat(new ObjectIdentityImpl(domain)).isEqualTo(identity);
|
assertThat(new ObjectIdentityImpl(domain)).isEqualTo(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
|
||||||
// ==================================================================================================
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private class MockIdDomainObject {
|
private class MockIdDomainObject {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,16 +56,10 @@ public abstract class AbstractBasicLookupStrategyTests {
|
||||||
|
|
||||||
protected static final Long OBJECT_IDENTITY_LONG_AS_UUID = 110L;
|
protected static final Long OBJECT_IDENTITY_LONG_AS_UUID = 110L;
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private BasicLookupStrategy strategy;
|
private BasicLookupStrategy strategy;
|
||||||
|
|
||||||
private static CacheManager cacheManager;
|
private static CacheManager cacheManager;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public abstract JdbcTemplate getJdbcTemplate();
|
public abstract JdbcTemplate getJdbcTemplate();
|
||||||
|
|
||||||
public abstract DataSource getDataSource();
|
public abstract DataSource getDataSource();
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ import javax.sql.DataSource;
|
||||||
*/
|
*/
|
||||||
public class DatabaseSeeder {
|
public class DatabaseSeeder {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public DatabaseSeeder(DataSource dataSource, Resource resource) throws IOException {
|
public DatabaseSeeder(DataSource dataSource, Resource resource) throws IOException {
|
||||||
Assert.notNull(dataSource, "dataSource required");
|
Assert.notNull(dataSource, "dataSource required");
|
||||||
Assert.notNull(resource, "resource required");
|
Assert.notNull(resource, "resource required");
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,6 @@ public class JdbcAclServiceTests {
|
||||||
assertThat(objectIdentities).isNull();
|
assertThat(objectIdentities).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Some integration tests
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void findChildrenWithoutIdType() {
|
public void findChildrenWithoutIdType() {
|
||||||
ObjectIdentity objectIdentity = new ObjectIdentityImpl(MockLongIdDomainObject.class, 4711L);
|
ObjectIdentity objectIdentity = new ObjectIdentityImpl(MockLongIdDomainObject.class, 4711L);
|
||||||
|
|
|
||||||
|
|
@ -64,18 +64,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@ContextConfiguration(locations = { "/jdbcMutableAclServiceTests-context.xml" })
|
@ContextConfiguration(locations = { "/jdbcMutableAclServiceTests-context.xml" })
|
||||||
public class JdbcMutableAclServiceTests extends AbstractTransactionalJUnit4SpringContextTests {
|
public class JdbcMutableAclServiceTests extends AbstractTransactionalJUnit4SpringContextTests {
|
||||||
|
|
||||||
// ~ Constant fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private static final String TARGET_CLASS = TargetObject.class.getName();
|
private static final String TARGET_CLASS = TargetObject.class.getName();
|
||||||
|
|
||||||
private final Authentication auth = new TestingAuthenticationToken("ben", "ignored", "ROLE_ADMINISTRATOR");
|
private final Authentication auth = new TestingAuthenticationToken("ben", "ignored", "ROLE_ADMINISTRATOR");
|
||||||
|
|
||||||
public static final String SELECT_ALL_CLASSES = "SELECT * FROM acl_class WHERE class = ?";
|
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 topParentOid = new ObjectIdentityImpl(TARGET_CLASS, 100L);
|
||||||
|
|
||||||
private final ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101L);
|
private final ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101L);
|
||||||
|
|
@ -97,9 +91,6 @@ public class JdbcMutableAclServiceTests extends AbstractTransactionalJUnit4Sprin
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
protected String getSqlClassPathResource() {
|
protected String getSqlClassPathResource() {
|
||||||
return "createAclSchema.sql";
|
return "createAclSchema.sql";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,6 @@ public class SidRetrievalStrategyTests {
|
||||||
|
|
||||||
Authentication authentication = new TestingAuthenticationToken("scott", "password", "A", "B", "C");
|
Authentication authentication = new TestingAuthenticationToken("scott", "password", "A", "B", "C");
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void correctSidsAreRetrieved() {
|
public void correctSidsAreRetrieved() {
|
||||||
SidRetrievalStrategy retrStrategy = new SidRetrievalStrategyImpl();
|
SidRetrievalStrategy retrStrategy = new SidRetrievalStrategyImpl();
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ import java.util.Collections;
|
||||||
|
|
||||||
public class SidTests {
|
public class SidTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrincipalSidConstructorsRequiredFields() {
|
public void testPrincipalSidConstructorsRequiredFields() {
|
||||||
// Check one String-argument constructor
|
// Check one String-argument constructor
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ public class ServiceProperties implements InitializingBean {
|
||||||
|
|
||||||
public static final String DEFAULT_CAS_SERVICE_PARAMETER = "service";
|
public static final String DEFAULT_CAS_SERVICE_PARAMETER = "service";
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private String service;
|
private String service;
|
||||||
|
|
||||||
private boolean authenticateAllArtifacts;
|
private boolean authenticateAllArtifacts;
|
||||||
|
|
@ -47,9 +44,6 @@ public class ServiceProperties implements InitializingBean {
|
||||||
|
|
||||||
private String serviceParameter = DEFAULT_CAS_SERVICE_PARAMETER;
|
private String serviceParameter = DEFAULT_CAS_SERVICE_PARAMETER;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.hasLength(this.service, "service cannot be empty.");
|
Assert.hasLength(this.service, "service cannot be empty.");
|
||||||
Assert.hasLength(this.artifactParameter, "artifactParameter cannot be empty.");
|
Assert.hasLength(this.artifactParameter, "artifactParameter cannot be empty.");
|
||||||
|
|
|
||||||
|
|
@ -56,14 +56,8 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class CasAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
|
public class CasAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(CasAuthenticationProvider.class);
|
private static final Log logger = LogFactory.getLog(CasAuthenticationProvider.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService;
|
private AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService;
|
||||||
|
|
||||||
private final UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
|
private final UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
|
||||||
|
|
@ -80,9 +74,6 @@ public class CasAuthenticationProvider implements AuthenticationProvider, Initia
|
||||||
|
|
||||||
private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
|
private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(this.authenticationUserDetailsService, "An authenticationUserDetailsService must be set");
|
Assert.notNull(this.authenticationUserDetailsService, "An authenticationUserDetailsService must be set");
|
||||||
Assert.notNull(this.ticketValidator, "A ticketValidator must be set");
|
Assert.notNull(this.ticketValidator, "A ticketValidator must be set");
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
|
||||||
|
|
||||||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
private final Object credentials;
|
private final Object credentials;
|
||||||
|
|
||||||
private final Object principal;
|
private final Object principal;
|
||||||
|
|
@ -48,9 +46,6 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
|
||||||
|
|
||||||
private final Assertion assertion;
|
private final Assertion assertion;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param key to identify if this object made by a given
|
* @param key to identify if this object made by a given
|
||||||
|
|
@ -110,9 +105,6 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
|
||||||
setAuthenticated(true);
|
setAuthenticated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
private static Integer extractKeyHash(String key) {
|
private static Integer extractKeyHash(String key) {
|
||||||
Assert.hasLength(key, "key cannot be null or empty");
|
Assert.hasLength(key, "key cannot be null or empty");
|
||||||
return key.hashCode();
|
return key.hashCode();
|
||||||
|
|
|
||||||
|
|
@ -32,19 +32,10 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class EhCacheBasedTicketCache implements StatelessTicketCache, InitializingBean {
|
public class EhCacheBasedTicketCache implements StatelessTicketCache, InitializingBean {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(EhCacheBasedTicketCache.class);
|
private static final Log logger = LogFactory.getLog(EhCacheBasedTicketCache.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private Ehcache cache;
|
private Ehcache cache;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(cache, "cache mandatory");
|
Assert.notNull(cache, "cache mandatory");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,27 +29,15 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class SpringCacheBasedTicketCache implements StatelessTicketCache {
|
public class SpringCacheBasedTicketCache implements StatelessTicketCache {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(SpringCacheBasedTicketCache.class);
|
private static final Log logger = LogFactory.getLog(SpringCacheBasedTicketCache.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Cache cache;
|
private final Cache cache;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public SpringCacheBasedTicketCache(Cache cache) {
|
public SpringCacheBasedTicketCache(Cache cache) {
|
||||||
Assert.notNull(cache, "cache mandatory");
|
Assert.notNull(cache, "cache mandatory");
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public CasAuthenticationToken getByTicketId(final String serviceTicket) {
|
public CasAuthenticationToken getByTicketId(final String serviceTicket) {
|
||||||
final Cache.ValueWrapper element = serviceTicket != null ? cache.get(serviceTicket) : null;
|
final Cache.ValueWrapper element = serviceTicket != null ? cache.get(serviceTicket) : null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,6 @@ package org.springframework.security.cas.authentication;
|
||||||
*/
|
*/
|
||||||
public interface StatelessTicketCache {
|
public interface StatelessTicketCache {
|
||||||
|
|
||||||
// ~ Methods ================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the <code>CasAuthenticationToken</code> associated with the specified
|
* Retrieves the <code>CasAuthenticationToken</code> associated with the specified
|
||||||
* ticket.
|
* ticket.
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean {
|
public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
private ServiceProperties serviceProperties;
|
private ServiceProperties serviceProperties;
|
||||||
|
|
||||||
private String loginUrl;
|
private String loginUrl;
|
||||||
|
|
@ -61,9 +59,6 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, In
|
||||||
*/
|
*/
|
||||||
private boolean encodeServiceUrlWithSessionId = true;
|
private boolean encodeServiceUrlWithSessionId = true;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.hasLength(this.loginUrl, "loginUrl must be specified");
|
Assert.hasLength(this.loginUrl, "loginUrl must be specified");
|
||||||
Assert.notNull(this.serviceProperties, "serviceProperties must be specified");
|
Assert.notNull(this.serviceProperties, "serviceProperties must be specified");
|
||||||
|
|
|
||||||
|
|
@ -173,9 +173,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to identify a CAS request for a stateful user agent, such as a web browser.
|
* Used to identify a CAS request for a stateful user agent, such as a web browser.
|
||||||
*/
|
*/
|
||||||
|
|
@ -205,17 +202,11 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
|
||||||
|
|
||||||
private AuthenticationFailureHandler proxyFailureHandler = new SimpleUrlAuthenticationFailureHandler();
|
private AuthenticationFailureHandler proxyFailureHandler = new SimpleUrlAuthenticationFailureHandler();
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public CasAuthenticationFilter() {
|
public CasAuthenticationFilter() {
|
||||||
super("/login/cas");
|
super("/login/cas");
|
||||||
setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
|
setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
protected final void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
||||||
FilterChain chain, Authentication authResult) throws IOException, ServletException {
|
FilterChain chain, Authentication authResult) throws IOException, ServletException {
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,8 @@ final class DefaultServiceAuthenticationDetails extends WebAuthenticationDetails
|
||||||
|
|
||||||
private static final long serialVersionUID = 6192409090610517700L;
|
private static final long serialVersionUID = 6192409090610517700L;
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final String serviceUrl;
|
private final String serviceUrl;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
* @param request the current {@link HttpServletRequest} to obtain the
|
* @param request the current {@link HttpServletRequest} to obtain the
|
||||||
|
|
@ -63,9 +57,6 @@ final class DefaultServiceAuthenticationDetails extends WebAuthenticationDetails
|
||||||
request.getRequestURI(), query);
|
request.getRequestURI(), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current URL minus the artifact parameter and its value, if present.
|
* Returns the current URL minus the artifact parameter and its value, if present.
|
||||||
* @see org.springframework.security.cas.web.authentication.ServiceAuthenticationDetails#getServiceUrl()
|
* @see org.springframework.security.cas.web.authentication.ServiceAuthenticationDetails#getServiceUrl()
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,10 @@ import org.springframework.util.Assert;
|
||||||
public class ServiceAuthenticationDetailsSource
|
public class ServiceAuthenticationDetailsSource
|
||||||
implements AuthenticationDetailsSource<HttpServletRequest, ServiceAuthenticationDetails> {
|
implements AuthenticationDetailsSource<HttpServletRequest, ServiceAuthenticationDetails> {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Pattern artifactPattern;
|
private final Pattern artifactPattern;
|
||||||
|
|
||||||
private ServiceProperties serviceProperties;
|
private ServiceProperties serviceProperties;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an implementation that uses the specified ServiceProperties and the default
|
* Creates an implementation that uses the specified ServiceProperties and the default
|
||||||
* CAS artifactParameterName.
|
* CAS artifactParameterName.
|
||||||
|
|
@ -69,9 +63,6 @@ public class ServiceAuthenticationDetailsSource
|
||||||
this.artifactPattern = DefaultServiceAuthenticationDetails.createArtifactPattern(artifactParameterName);
|
this.artifactPattern = DefaultServiceAuthenticationDetails.createArtifactPattern(artifactParameterName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param context the {@code HttpServletRequest} object.
|
* @param context the {@code HttpServletRequest} object.
|
||||||
* @return the {@code ServiceAuthenticationDetails} containing information about the
|
* @return the {@code ServiceAuthenticationDetails} containing information about the
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,6 @@ import java.util.*;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class CasAuthenticationProviderTests {
|
public class CasAuthenticationProviderTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
private UserDetails makeUserDetails() {
|
private UserDetails makeUserDetails() {
|
||||||
return new User("user", "password", true, true, true, true,
|
return new User("user", "password", true, true, true, true,
|
||||||
AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));
|
AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));
|
||||||
|
|
@ -372,9 +369,6 @@ public class CasAuthenticationProviderTests {
|
||||||
assertThat(cap.supports(CasAuthenticationToken.class)).isTrue();
|
assertThat(cap.supports(CasAuthenticationToken.class)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
|
||||||
// ==================================================================================================
|
|
||||||
|
|
||||||
private class MockAuthoritiesPopulator implements AuthenticationUserDetailsService {
|
private class MockAuthoritiesPopulator implements AuthenticationUserDetailsService {
|
||||||
|
|
||||||
public UserDetails loadUserDetails(final Authentication token) throws UsernameNotFoundException {
|
public UserDetails loadUserDetails(final Authentication token) throws UsernameNotFoundException {
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,6 @@ public class EhCacheBasedTicketCacheTests extends AbstractStatelessTicketCacheTe
|
||||||
|
|
||||||
private static CacheManager cacheManager;
|
private static CacheManager cacheManager;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void initCacheManaer() {
|
public static void initCacheManaer() {
|
||||||
cacheManager = CacheManager.create();
|
cacheManager = CacheManager.create();
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ public class SpringCacheBasedTicketCacheTests extends AbstractStatelessTicketCac
|
||||||
|
|
||||||
private static CacheManager cacheManager;
|
private static CacheManager cacheManager;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void initCacheManaer() {
|
public static void initCacheManaer() {
|
||||||
cacheManager = new ConcurrentMapCacheManager();
|
cacheManager = new ConcurrentMapCacheManager();
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ import org.springframework.security.cas.ServiceProperties;
|
||||||
*/
|
*/
|
||||||
public class CasAuthenticationEntryPointTests {
|
public class CasAuthenticationEntryPointTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
@Test
|
@Test
|
||||||
public void testDetectsMissingLoginFormUrl() throws Exception {
|
public void testDetectsMissingLoginFormUrl() throws Exception {
|
||||||
CasAuthenticationEntryPoint ep = new CasAuthenticationEntryPoint();
|
CasAuthenticationEntryPoint ep = new CasAuthenticationEntryPoint();
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,6 @@ import static org.mockito.Mockito.*;
|
||||||
*/
|
*/
|
||||||
public class CasAuthenticationFilterTests {
|
public class CasAuthenticationFilterTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
SecurityContextHolder.clearContext();
|
SecurityContextHolder.clearContext();
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,6 @@ import org.springframework.security.cas.ServiceProperties;
|
||||||
*/
|
*/
|
||||||
public class ServicePropertiesTests {
|
public class ServicePropertiesTests {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void detectsMissingService() throws Exception {
|
public void detectsMissingService() throws Exception {
|
||||||
ServiceProperties sp = new ServiceProperties();
|
ServiceProperties sp = new ServiceProperties();
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class DataSourcePopulator implements InitializingBean {
|
public class DataSourcePopulator implements InitializingBean {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
JdbcTemplate template;
|
JdbcTemplate template;
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,6 @@ public class FilterChainProxyConfigTests {
|
||||||
|
|
||||||
private ClassPathXmlApplicationContext appCtx;
|
private ClassPathXmlApplicationContext appCtx;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void loadContext() {
|
public void loadContext() {
|
||||||
System.setProperty("sec1235.pattern1", "/login");
|
System.setProperty("sec1235.pattern1", "/login");
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public interface AccessDecisionManager {
|
public interface AccessDecisionManager {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves an access control decision for the passed parameters.
|
* Resolves an access control decision for the passed parameters.
|
||||||
* @param authentication the caller invoking the method (not null)
|
* @param authentication the caller invoking the method (not null)
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,12 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public interface AccessDecisionVoter<S> {
|
public interface AccessDecisionVoter<S> {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
int ACCESS_GRANTED = 1;
|
int ACCESS_GRANTED = 1;
|
||||||
|
|
||||||
int ACCESS_ABSTAIN = 0;
|
int ACCESS_ABSTAIN = 0;
|
||||||
|
|
||||||
int ACCESS_DENIED = -1;
|
int ACCESS_DENIED = -1;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether this {@code AccessDecisionVoter} is able to vote on the passed
|
* Indicates whether this {@code AccessDecisionVoter} is able to vote on the passed
|
||||||
* {@code ConfigAttribute}.
|
* {@code ConfigAttribute}.
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,6 @@ package org.springframework.security.access;
|
||||||
*/
|
*/
|
||||||
public class AccessDeniedException extends RuntimeException {
|
public class AccessDeniedException extends RuntimeException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>AccessDeniedException</code> with the specified message.
|
* Constructs an <code>AccessDeniedException</code> with the specified message.
|
||||||
* @param msg the detail message
|
* @param msg the detail message
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,6 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public interface AfterInvocationProvider {
|
public interface AfterInvocationProvider {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> attributes,
|
Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> attributes,
|
||||||
Object returnedObject) throws AccessDeniedException;
|
Object returnedObject) throws AccessDeniedException;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@ package org.springframework.security.access;
|
||||||
*/
|
*/
|
||||||
public class AuthorizationServiceException extends AccessDeniedException {
|
public class AuthorizationServiceException extends AccessDeniedException {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an <code>AuthorizationServiceException</code> with the specified
|
* Constructs an <code>AuthorizationServiceException</code> with the specified
|
||||||
* message.
|
* message.
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,6 @@ import org.springframework.security.access.intercept.RunAsManager;
|
||||||
*/
|
*/
|
||||||
public interface ConfigAttribute extends Serializable {
|
public interface ConfigAttribute extends Serializable {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the <code>ConfigAttribute</code> can be represented as a <code>String</code> and
|
* If the <code>ConfigAttribute</code> can be represented as a <code>String</code> and
|
||||||
* that <code>String</code> is sufficient in precision to be relied upon as a
|
* that <code>String</code> is sufficient in precision to be relied upon as a
|
||||||
|
|
|
||||||
|
|
@ -29,22 +29,13 @@ import org.springframework.util.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class SecurityConfig implements ConfigAttribute {
|
public class SecurityConfig implements ConfigAttribute {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final String attrib;
|
private final String attrib;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public SecurityConfig(String config) {
|
public SecurityConfig(String config) {
|
||||||
Assert.hasText(config, "You must provide a configuration attribute");
|
Assert.hasText(config, "You must provide a configuration attribute");
|
||||||
this.attrib = config;
|
this.attrib = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof ConfigAttribute) {
|
if (obj instanceof ConfigAttribute) {
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,6 @@ import org.springframework.security.access.intercept.AbstractSecurityInterceptor
|
||||||
*/
|
*/
|
||||||
public interface SecurityMetadataSource extends AopInfrastructureBean {
|
public interface SecurityMetadataSource extends AopInfrastructureBean {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accesses the {@code ConfigAttribute}s that apply to a given secure object.
|
* Accesses the {@code ConfigAttribute}s that apply to a given secure object.
|
||||||
* @param object the object being secured
|
* @param object the object being secured
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ import org.springframework.context.ApplicationEvent;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAuthorizationEvent extends ApplicationEvent {
|
public abstract class AbstractAuthorizationEvent extends ApplicationEvent {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the event, passing in the secure object being intercepted.
|
* Construct the event, passing in the secure object being intercepted.
|
||||||
* @param secureObject the secure object
|
* @param secureObject the secure object
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,10 @@ import org.springframework.security.authentication.AuthenticationCredentialsNotF
|
||||||
*/
|
*/
|
||||||
public class AuthenticationCredentialsNotFoundEvent extends AbstractAuthorizationEvent {
|
public class AuthenticationCredentialsNotFoundEvent extends AbstractAuthorizationEvent {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private AuthenticationCredentialsNotFoundException credentialsNotFoundException;
|
private AuthenticationCredentialsNotFoundException credentialsNotFoundException;
|
||||||
|
|
||||||
private Collection<ConfigAttribute> configAttribs;
|
private Collection<ConfigAttribute> configAttribs;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the event.
|
* Construct the event.
|
||||||
* @param secureObject the secure object
|
* @param secureObject the secure object
|
||||||
|
|
@ -59,9 +53,6 @@ public class AuthenticationCredentialsNotFoundEvent extends AbstractAuthorizatio
|
||||||
this.credentialsNotFoundException = credentialsNotFoundException;
|
this.credentialsNotFoundException = credentialsNotFoundException;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Collection<ConfigAttribute> getConfigAttributes() {
|
public Collection<ConfigAttribute> getConfigAttributes() {
|
||||||
return configAttribs;
|
return configAttribs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,18 +36,12 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public class AuthorizationFailureEvent extends AbstractAuthorizationEvent {
|
public class AuthorizationFailureEvent extends AbstractAuthorizationEvent {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private AccessDeniedException accessDeniedException;
|
private AccessDeniedException accessDeniedException;
|
||||||
|
|
||||||
private Authentication authentication;
|
private Authentication authentication;
|
||||||
|
|
||||||
private Collection<ConfigAttribute> configAttributes;
|
private Collection<ConfigAttribute> configAttributes;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the event.
|
* Construct the event.
|
||||||
* @param secureObject the secure object
|
* @param secureObject the secure object
|
||||||
|
|
@ -70,9 +64,6 @@ public class AuthorizationFailureEvent extends AbstractAuthorizationEvent {
|
||||||
this.accessDeniedException = accessDeniedException;
|
this.accessDeniedException = accessDeniedException;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public AccessDeniedException getAccessDeniedException() {
|
public AccessDeniedException getAccessDeniedException() {
|
||||||
return accessDeniedException;
|
return accessDeniedException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,16 +31,10 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public class AuthorizedEvent extends AbstractAuthorizationEvent {
|
public class AuthorizedEvent extends AbstractAuthorizationEvent {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private Authentication authentication;
|
private Authentication authentication;
|
||||||
|
|
||||||
private Collection<ConfigAttribute> configAttributes;
|
private Collection<ConfigAttribute> configAttributes;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the event.
|
* Construct the event.
|
||||||
* @param secureObject the secure object
|
* @param secureObject the secure object
|
||||||
|
|
@ -59,9 +53,6 @@ public class AuthorizedEvent extends AbstractAuthorizationEvent {
|
||||||
this.authentication = authentication;
|
this.authentication = authentication;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Authentication getAuthentication() {
|
public Authentication getAuthentication() {
|
||||||
return authentication;
|
return authentication;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,8 @@ import org.springframework.context.ApplicationListener;
|
||||||
*/
|
*/
|
||||||
public class LoggerListener implements ApplicationListener<AbstractAuthorizationEvent> {
|
public class LoggerListener implements ApplicationListener<AbstractAuthorizationEvent> {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(LoggerListener.class);
|
private static final Log logger = LogFactory.getLog(LoggerListener.class);
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void onApplicationEvent(AbstractAuthorizationEvent event) {
|
public void onApplicationEvent(AbstractAuthorizationEvent event) {
|
||||||
if (event instanceof AuthenticationCredentialsNotFoundEvent) {
|
if (event instanceof AuthenticationCredentialsNotFoundEvent) {
|
||||||
AuthenticationCredentialsNotFoundEvent authEvent = (AuthenticationCredentialsNotFoundEvent) event;
|
AuthenticationCredentialsNotFoundEvent authEvent = (AuthenticationCredentialsNotFoundEvent) event;
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,6 @@ package org.springframework.security.access.event;
|
||||||
*/
|
*/
|
||||||
public class PublicInvocationEvent extends AbstractAuthorizationEvent {
|
public class PublicInvocationEvent extends AbstractAuthorizationEvent {
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the event, passing in the public secure object.
|
* Construct the event, passing in the public secure object.
|
||||||
* @param secureObject the public secure object
|
* @param secureObject the public secure object
|
||||||
|
|
|
||||||
|
|
@ -104,14 +104,8 @@ import org.springframework.util.Assert;
|
||||||
public abstract class AbstractSecurityInterceptor
|
public abstract class AbstractSecurityInterceptor
|
||||||
implements InitializingBean, ApplicationEventPublisherAware, MessageSourceAware {
|
implements InitializingBean, ApplicationEventPublisherAware, MessageSourceAware {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||||
|
|
||||||
private ApplicationEventPublisher eventPublisher;
|
private ApplicationEventPublisher eventPublisher;
|
||||||
|
|
@ -132,9 +126,6 @@ public abstract class AbstractSecurityInterceptor
|
||||||
|
|
||||||
private boolean publishAuthorizationSuccess = false;
|
private boolean publishAuthorizationSuccess = false;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(getSecureObjectClass(), "Subclass must provide a non-null response to getSecureObjectClass()");
|
Assert.notNull(getSecureObjectClass(), "Subclass must provide a non-null response to getSecureObjectClass()");
|
||||||
Assert.notNull(this.messages, "A message source must be set");
|
Assert.notNull(this.messages, "A message source must be set");
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,6 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public interface AfterInvocationManager {
|
public interface AfterInvocationManager {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given the details of a secure object invocation including its returned
|
* Given the details of a secure object invocation including its returned
|
||||||
* <code>Object</code>, make an access control decision or optionally modify the
|
* <code>Object</code>, make an access control decision or optionally modify the
|
||||||
|
|
|
||||||
|
|
@ -47,19 +47,10 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class AfterInvocationProviderManager implements AfterInvocationManager, InitializingBean {
|
public class AfterInvocationProviderManager implements AfterInvocationManager, InitializingBean {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log logger = LogFactory.getLog(AfterInvocationProviderManager.class);
|
protected static final Log logger = LogFactory.getLog(AfterInvocationProviderManager.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private List<AfterInvocationProvider> providers;
|
private List<AfterInvocationProvider> providers;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
checkIfValidList(this.providers);
|
checkIfValidList(this.providers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ import org.springframework.security.core.context.SecurityContext;
|
||||||
*/
|
*/
|
||||||
public class InterceptorStatusToken {
|
public class InterceptorStatusToken {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private SecurityContext securityContext;
|
private SecurityContext securityContext;
|
||||||
|
|
||||||
private Collection<ConfigAttribute> attr;
|
private Collection<ConfigAttribute> attr;
|
||||||
|
|
@ -43,9 +40,6 @@ public class InterceptorStatusToken {
|
||||||
|
|
||||||
private boolean contextHolderRefreshRequired;
|
private boolean contextHolderRefreshRequired;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public InterceptorStatusToken(SecurityContext securityContext, boolean contextHolderRefreshRequired,
|
public InterceptorStatusToken(SecurityContext securityContext, boolean contextHolderRefreshRequired,
|
||||||
Collection<ConfigAttribute> attributes, Object secureObject) {
|
Collection<ConfigAttribute> attributes, Object secureObject) {
|
||||||
this.securityContext = securityContext;
|
this.securityContext = securityContext;
|
||||||
|
|
@ -54,9 +48,6 @@ public class InterceptorStatusToken {
|
||||||
this.secureObject = secureObject;
|
this.secureObject = secureObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Collection<ConfigAttribute> getAttributes() {
|
public Collection<ConfigAttribute> getAttributes() {
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,19 +44,10 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class MethodInvocationPrivilegeEvaluator implements InitializingBean {
|
public class MethodInvocationPrivilegeEvaluator implements InitializingBean {
|
||||||
|
|
||||||
// ~ Static fields/initializers
|
|
||||||
// =====================================================================================
|
|
||||||
|
|
||||||
protected static final Log logger = LogFactory.getLog(MethodInvocationPrivilegeEvaluator.class);
|
protected static final Log logger = LogFactory.getLog(MethodInvocationPrivilegeEvaluator.class);
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private AbstractSecurityInterceptor securityInterceptor;
|
private AbstractSecurityInterceptor securityInterceptor;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(securityInterceptor, "SecurityInterceptor required");
|
Assert.notNull(securityInterceptor, "SecurityInterceptor required");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,6 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
final class NullRunAsManager implements RunAsManager {
|
final class NullRunAsManager implements RunAsManager {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Authentication buildRunAs(Authentication authentication, Object object, Collection<ConfigAttribute> config) {
|
public Authentication buildRunAs(Authentication authentication, Object object, Collection<ConfigAttribute> config) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,16 +45,10 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class RunAsImplAuthenticationProvider implements InitializingBean, AuthenticationProvider, MessageSourceAware {
|
public class RunAsImplAuthenticationProvider implements InitializingBean, AuthenticationProvider, MessageSourceAware {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(key, "A Key is required and should match that configured for the RunAsManagerImpl");
|
Assert.notNull(key, "A Key is required and should match that configured for the RunAsManagerImpl");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,6 @@ import org.springframework.security.core.Authentication;
|
||||||
*/
|
*/
|
||||||
public interface RunAsManager {
|
public interface RunAsManager {
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a replacement <code>Authentication</code> object for the current secure
|
* Returns a replacement <code>Authentication</code> object for the current secure
|
||||||
* object invocation, or <code>null</code> if replacement not required.
|
* object invocation, or <code>null</code> if replacement not required.
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,10 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class RunAsManagerImpl implements RunAsManager, InitializingBean {
|
public class RunAsManagerImpl implements RunAsManager, InitializingBean {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
private String rolePrefix = "ROLE_";
|
private String rolePrefix = "ROLE_";
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(key,
|
Assert.notNull(key,
|
||||||
"A Key is required and should match that configured for the RunAsImplAuthenticationProvider");
|
"A Key is required and should match that configured for the RunAsImplAuthenticationProvider");
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ public class RunAsUserToken extends AbstractAuthenticationToken {
|
||||||
|
|
||||||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private final Class<? extends Authentication> originalAuthentication;
|
private final Class<? extends Authentication> originalAuthentication;
|
||||||
|
|
||||||
private final Object credentials;
|
private final Object credentials;
|
||||||
|
|
@ -44,9 +41,6 @@ public class RunAsUserToken extends AbstractAuthenticationToken {
|
||||||
|
|
||||||
private final int keyHash;
|
private final int keyHash;
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
public RunAsUserToken(String key, Object principal, Object credentials,
|
public RunAsUserToken(String key, Object principal, Object credentials,
|
||||||
Collection<? extends GrantedAuthority> authorities,
|
Collection<? extends GrantedAuthority> authorities,
|
||||||
Class<? extends Authentication> originalAuthentication) {
|
Class<? extends Authentication> originalAuthentication) {
|
||||||
|
|
@ -58,9 +52,6 @@ public class RunAsUserToken extends AbstractAuthenticationToken {
|
||||||
setAuthenticated(true);
|
setAuthenticated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getCredentials() {
|
public Object getCredentials() {
|
||||||
return this.credentials;
|
return this.credentials;
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,8 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||||
*/
|
*/
|
||||||
public class MethodSecurityInterceptor extends AbstractSecurityInterceptor implements MethodInterceptor {
|
public class MethodSecurityInterceptor extends AbstractSecurityInterceptor implements MethodInterceptor {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private MethodSecurityMetadataSource securityMetadataSource;
|
private MethodSecurityMetadataSource securityMetadataSource;
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Class<?> getSecureObjectClass() {
|
public Class<?> getSecureObjectClass() {
|
||||||
return MethodInvocation.class;
|
return MethodInvocation.class;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,6 @@ import org.springframework.util.Assert;
|
||||||
*/
|
*/
|
||||||
public class MethodSecurityMetadataSourceAdvisor extends AbstractPointcutAdvisor implements BeanFactoryAware {
|
public class MethodSecurityMetadataSourceAdvisor extends AbstractPointcutAdvisor implements BeanFactoryAware {
|
||||||
|
|
||||||
// ~ Instance fields
|
|
||||||
// ================================================================================================
|
|
||||||
|
|
||||||
private transient MethodSecurityMetadataSource attributeSource;
|
private transient MethodSecurityMetadataSource attributeSource;
|
||||||
|
|
||||||
private transient MethodInterceptor interceptor;
|
private transient MethodInterceptor interceptor;
|
||||||
|
|
@ -70,9 +67,6 @@ public class MethodSecurityMetadataSourceAdvisor extends AbstractPointcutAdvisor
|
||||||
|
|
||||||
private transient volatile Object adviceMonitor = new Object();
|
private transient volatile Object adviceMonitor = new Object();
|
||||||
|
|
||||||
// ~ Constructors
|
|
||||||
// ===================================================================================================
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alternative constructor for situations where we want the advisor decoupled from the
|
* Alternative constructor for situations where we want the advisor decoupled from the
|
||||||
* advice. Instead the advice bean name should be set. This prevents eager
|
* advice. Instead the advice bean name should be set. This prevents eager
|
||||||
|
|
@ -96,9 +90,6 @@ public class MethodSecurityMetadataSourceAdvisor extends AbstractPointcutAdvisor
|
||||||
this.metadataSourceBeanName = attributeSourceBeanName;
|
this.metadataSourceBeanName = attributeSourceBeanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Methods
|
|
||||||
// ========================================================================================================
|
|
||||||
|
|
||||||
public Pointcut getPointcut() {
|
public Pointcut getPointcut() {
|
||||||
return pointcut;
|
return pointcut;
|
||||||
}
|
}
|
||||||
|
|
@ -124,9 +115,6 @@ public class MethodSecurityMetadataSourceAdvisor extends AbstractPointcutAdvisor
|
||||||
attributeSource = beanFactory.getBean(metadataSourceBeanName, MethodSecurityMetadataSource.class);
|
attributeSource = beanFactory.getBean(metadataSourceBeanName, MethodSecurityMetadataSource.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ Inner Classes
|
|
||||||
// ==================================================================================================
|
|
||||||
|
|
||||||
class MethodSecurityMetadataSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
|
class MethodSecurityMetadataSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue