|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.acegisecurity.acl.basic.BasicAclProvider
public class BasicAclProvider
Retrieves access control lists (ACL) entries for domain object instances from a data access object (DAO).
This implementation will provide ACL lookup services for any object that it
can determine the AclObjectIdentity for by calling the obtainIdentity(Object) method. Subclasses can override this method if
they only want the BasicAclProvider responding to particular
domain object instances.
BasicAclProvider will walk an inheritance hierarchy if a
BasicAclEntry returned by the DAO indicates it has a parent.
NB: inheritance occurs at a domain instance object level. It does
not occur at an ACL recipient level. This means
allBasicAclEntrys for a given domain instance object
must have the same parent identity, or
allBasicAclEntrys must have null as their
parent identity.
A cache should be used. This is provided by the BasicAclEntryCache.
BasicAclProvider by default is setup to use the NullAclEntryCache, which performs no caching.
To implement the getAcls(Object, Authentication) method,
BasicAclProvider requires a EffectiveAclsResolver to
be configured against it. By default the GrantedAuthorityEffectiveAclsResolver is used.
| Constructor Summary | |
|---|---|
BasicAclProvider()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
AclEntry[] |
getAcls(Object domainInstance)
Obtains the ACLs that apply to the specified domain instance. |
AclEntry[] |
getAcls(Object domainInstance,
Authentication authentication)
Obtains the ACLs that apply to the specified domain instance and presented Authentication object. |
BasicAclDao |
getBasicAclDao()
|
BasicAclEntryCache |
getBasicAclEntryCache()
|
Class |
getDefaultAclObjectIdentityClass()
|
EffectiveAclsResolver |
getEffectiveAclsResolver()
|
Class |
getRestrictSupportToClass()
|
protected AclObjectIdentity |
obtainIdentity(Object domainInstance)
This method looks up the AclObjectIdentity of a passed
domain object instance. |
void |
setBasicAclDao(BasicAclDao basicAclDao)
|
void |
setBasicAclEntryCache(BasicAclEntryCache basicAclEntryCache)
|
void |
setDefaultAclObjectIdentityClass(Class defaultAclObjectIdentityClass)
Allows selection of the AclObjectIdentity class that an
attempt should be made to construct if the passed object does not
implement AclObjectIdentityAware. |
void |
setEffectiveAclsResolver(EffectiveAclsResolver effectiveAclsResolver)
|
void |
setRestrictSupportToClass(Class restrictSupportToClass)
If set to a value other than null, the supports(Object) method will only support the indicates class. |
boolean |
supports(Object domainInstance)
Indicates support for the passed object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicAclProvider()
| Method Detail |
|---|
public AclEntry[] getAcls(Object domainInstance)
AclProvider
Will never be called unless the AclProvider.supports(Object) method
returned true.
getAcls in interface AclProviderdomainInstance - the instance for which ACL information is required
(never null)
null if no ACLs apply to
the specified domain instance
public AclEntry[] getAcls(Object domainInstance,
Authentication authentication)
AclProviderAuthentication object.
Will never be called unless the AclProvider.supports(Object) method
returned true.
getAcls in interface AclProviderdomainInstance - the instance for which ACL information is required
(never null)authentication - the prncipal for which ACL information should be
filtered (never null)
null) if no such ACLs
are foundpublic void setBasicAclDao(BasicAclDao basicAclDao)
public BasicAclDao getBasicAclDao()
public void setBasicAclEntryCache(BasicAclEntryCache basicAclEntryCache)
public BasicAclEntryCache getBasicAclEntryCache()
public void setDefaultAclObjectIdentityClass(Class defaultAclObjectIdentityClass)
AclObjectIdentity class that an
attempt should be made to construct if the passed object does not
implement AclObjectIdentityAware.
NB: Any defaultAclObjectIdentityClassmust provide a
public constructor that accepts an Object. Otherwise it is
not possible for the BasicAclProvider to try to create the
AclObjectIdentity instance at runtime.
defaultAclObjectIdentityClass - public Class getDefaultAclObjectIdentityClass()
public void setEffectiveAclsResolver(EffectiveAclsResolver effectiveAclsResolver)
public EffectiveAclsResolver getEffectiveAclsResolver()
public void setRestrictSupportToClass(Class restrictSupportToClass)
null, the supports(Object) method will only support the indicates class.
This is useful if you wish to wire multiple
BasicAclProviders in a list of
AclProviderManager.providers but only have particular
instances respond to particular domain object types.
restrictSupportToClass - the class to restrict this
BasicAclProvider to service request for, or
null (the default) if the
BasicAclProvider should respond to every class
presentedpublic Class getRestrictSupportToClass()
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic boolean supports(Object domainInstance)
An object will only be supported if it (i) is allowed to be supported as
defined by the setRestrictSupportToClass(Class) method,
and (ii) if an AclObjectIdentity is returned by
obtainIdentity(Object) for that object.
supports in interface AclProviderdomainInstance - the instance to check
true if this provider supports the passed object,
false otherwiseprotected AclObjectIdentity obtainIdentity(Object domainInstance)
AclObjectIdentity of a passed
domain object instance.
This implementation attempts to obtain the
AclObjectIdentity via reflection inspection of the class
for the AclObjectIdentityAware interface. If this fails, an
attempt is made to construct a getDefaultAclObjectIdentityClass() object by passing the domain
instance object into its constructor.
domainInstance - the domain object instance (never
null)
null if one could not be
obtained
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||