public class StandardSecurityPolicy extends GenericService implements SecurityPolicy
This policy only supports testing against SecuredObjects.
SecurityPolicy
,
StandardAccessRight
,
DenyRight
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
SERVICE_INFO_KEY
DENIED, GRANTED, UNSPECIFIED
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
StandardSecurityPolicy() |
Modifier and Type | Method and Description |
---|---|
int |
checkAccess(java.lang.Object pObject,
User pUser,
AccessRight pRight)
Utility method that works like hasAccess() but returns the different
states of getAccess().
|
int |
getAccess(AccessControlList pAcl,
java.lang.Object pObject,
Persona pPersona,
AccessRight pRight,
boolean pExactPersona)
Returns the access state specified within by the ACL, which
is usually a subset of the effective ACL of the specified
SecuredObject, for the indicated Persona.
|
protected Persona |
getCompatiblePersona(Persona pPersona,
UserAuthority pAuthority)
This attempts to find a persona that is compatible with the indicated
user authority.
|
protected Persona[] |
getCompatiblePersonae(Persona[] pPersonae,
UserAuthority pAuthority)
This performs a getCompatiblePersona() call on an array of personae.
|
protected AccessControlList |
getCompleteAccessControlList(Persona pPersona,
SecurityConfiguration pConfig)
Returns an access control list containing all of the access rights
specified in the security configuration.
|
AccessControlList |
getCreationAccessControlList(java.lang.Object pObject)
Returns the access control list that should be applied to
a new object when it is created.
|
protected AccessControlList |
getCreationAccessControlList(SecuredContainer[] pContainers)
Returns the access control list created by concatenating all of the
creation access control lists of the specified containers.
|
Persona |
getCreationOwner(java.lang.Object pObject)
Determines the owner that should be applied to a new object
when it is created.
|
protected AccessControlList |
getCreationOwnerAccessControlList(Persona pOwner,
SecuredContainer[] pContainers)
Returns the access control list appropriate for the creator of the
object, constructed from the creation access control list templates
of all of its containers, using the specified persona as the
owner.
|
protected AccessControlList |
getCreationSubPersonaeAccessControlList(Persona[] pSubPersonae,
SecuredContainer[] pContainers)
Returns the access control list appropriate for all of the sub-personae
of the object, constructed from the creation access control list
templates of all of its containers.
|
protected User |
getCurrentUser()
Determines the current user.
|
AccessControlList |
getEffectiveAccessControlList(java.lang.Object pObject)
Determines the effective access control list for the indicated
object, which is a combination of the object's access control
list and any access control lists of its containers.
|
AccessControlList |
getImpliedAccessControlList(java.lang.Object pObject)
Determines the access control list fragment that is implied by
any containers that the object may be a member of.
|
protected Persona[] |
getUserPersonae(SecurityConfiguration config)
Returns the list of personae that apply to the current user.
|
boolean |
hasAccess(java.lang.Object pObject,
User pUser,
AccessRight pRight)
Returns true if the user may perform a particular operation on
an object.
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public int checkAccess(java.lang.Object pObject, User pUser, AccessRight pRight) throws SecurityException
SecurityException
protected Persona getCompatiblePersona(Persona pPersona, UserAuthority pAuthority)
protected Persona[] getCompatiblePersonae(Persona[] pPersonae, UserAuthority pAuthority)
protected AccessControlList getCompleteAccessControlList(Persona pPersona, SecurityConfiguration pConfig)
protected AccessControlList getCreationAccessControlList(SecuredContainer[] pContainers) throws SecurityException
SecurityException
protected AccessControlList getCreationOwnerAccessControlList(Persona pOwner, SecuredContainer[] pContainers) throws SecurityException
This ACL will not have been optimized.
SecurityException
protected AccessControlList getCreationSubPersonaeAccessControlList(Persona[] pSubPersonae, SecuredContainer[] pContainers) throws SecurityException
This ACL will not have been optimized.
SecurityException
protected User getCurrentUser()
protected Persona[] getUserPersonae(SecurityConfiguration config)
public boolean hasAccess(java.lang.Object pObject, User pUser, AccessRight pRight) throws SecurityException
This implementation only supports SecuredObjects.
This implementation calls getEffectiveAccessControlList() to determine the ACL for the specified object. It then determines the set of applicable personae from the User object using the user authority specified by the security context object in the SecuredObject. It then calls hasAccess() once for every applicable persona. If any call to hasAccess() returns DENIED, access is denied. If not, and any call returns GRANTED, access is granted. If UNSPECIFIED is returne for all personae, or there are no personae, access is denied.
hasAccess
in interface SecurityPolicy
SecurityException
getCurrentUser()
public int getAccess(AccessControlList pAcl, java.lang.Object pObject, Persona pPersona, AccessRight pRight, boolean pExactPersona) throws SecurityException
This method is used by StandardSecurityPolicy.hasAccess() to determine the accessibility of an object by a particular user, as outlined in the descriptor for that method.
In this implementation access is denied if any "deny" access control entry with the requested access right applies to the persona (i.e. deny rights trump allow rights).
This implementation grants ACL_READ and ACL_WRITE access to
the owner of the object if the pObject argument is a
SecuredObject
.
This implementation allows access if the access control list is null (unspecified). The following subclass will reverse that behavior:
public class DefaultDenySecurityPolicy extends StandardSecurityPolicy { public int getAccess(AccessControlList pAcl, Object pObject, Persona pPersona, AccessRight pRight, boolean pExactPersona) { if (pAcl == null) return DENIED; else return super.getAccess(pAcl, pObject, pPersona, pRight, pExactPersona); } }
The following subclass will deny access except during the hours of 9 to 5 in the default (local) time zone:
public class DenyOutsideBusinessHoursSecurityPolicy extends StandardSecurityPolicy { public int getAccess(AccessControlList pAcl, Object pObject, Persona pPersona, AccessRight pRight, boolean pExactPersona) { Calendar calender = new GregorianCalendar(new Date()); int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY); if ((hourOfDay < 9) || (hourOfDay > 5)) return DENIED; else return super.getAccess(pAcl, pObject, pPersona, pRight, pExactPersona); } }
getAccess
in interface SecurityPolicy
SecurityException
SecurityPolicy.hasAccess(java.lang.Object, atg.security.User, atg.security.AccessRight)
public AccessControlList getImpliedAccessControlList(java.lang.Object pObject) throws SecurityException
In this implementation, the implied access control list is the union of all access control lists of objects returned by SecuredObject.unsecuredGetSecuredContainers() where the owner of the secured container has StandardAccessRights.ACL_WRITE access on the object specified within the object's ACL. The ownership test is performed so that the owner of a container may not adjust access control rights on an object that he would otherwise have no ability to do, for example to deny access to the object's owner or allow access to himself.
getImpliedAccessControlList
in interface SecurityPolicy
SecurityException
public AccessControlList getEffectiveAccessControlList(java.lang.Object pObject) throws SecurityException
In this implementation the implied access control list and object access control list are simply concatenated.
getEffectiveAccessControlList
in interface SecurityPolicy
SecurityException
public Persona getCreationOwner(java.lang.Object pObject) throws SecurityException
This implementation simply returns the current thread's primary persona for its user authority.
getCreationOwner
in interface SecurityPolicy
SecurityException
public AccessControlList getCreationAccessControlList(java.lang.Object pObject) throws SecurityException
If the object has no containers then this will return an ACL allowing all permissions to the creation owner (determined by getCreationOwner()).
If the object has containers then an ACL will be created by concatenating the following ACL fragments created from each of the object containers:
The ACL returned from this method will have been optimized.
getCreationAccessControlList
in interface SecurityPolicy
SecurityException