public class GenericSecuredRepository extends GenericService implements SecuredRepository, atg.repository.DisplayableRepository, atg.repository.RepositoryWrapper
This implementation is not intended to provide absolute security, but rather to allow an application the ability to provide security features without having to implement its own access checking.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
protected atg.adapter.secure.WeakItemCache |
mItemCache
A cache of secured repository items indexed by the repository
item.
|
protected Repository |
mRepository
The repository we're wrapping.
|
protected SecurityConfiguration |
mSecurityConfiguration
The security configuration of the repository.
|
protected javax.transaction.TransactionManager |
mTransactionManager
The transaction manager to use for transactions while we do
repository work.
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
GenericSecuredRepository()
Creates a secured repository that can be used to wrap a normal
repository.
|
GenericSecuredRepository(Repository pRepository,
SecurityConfiguration pConfiguration)
Creates a secured repository that wraps a normal repository.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkAccess(GenericSecuredRepositoryItem pItem,
AccessRight pRight)
Checks to see if the specified access is allowed on an item and,
if not, throws a RepositorySecurityException that wraps a
PermissionDeniedException.
|
void |
checkAccess(java.lang.String pDescriptorName,
AccessRight pRight)
Checks to see if the current user has the indicated access right
for an item descriptor.
|
protected void |
checkAccess(java.lang.String pId,
java.lang.String pDescriptorName,
AccessRight pRight)
Looks up a secured repository item and checks to see if the user has
the indicated access right on it.
|
protected void |
checkForInvalidRepository() |
void |
doStartService()
This is called after a Service has been created, placed into the
naming hierarchy, and initialized with its configured property
values.
|
RepositoryItem[] |
filterItems(RepositoryItem[] pItems,
AccessRight pRight)
Filters out any repository items returned from a query that the user
should not be able to access in the indicated mode.
|
java.lang.String |
getComponentResourceBundleName()
Get property
componentResourceBundleName |
atg.xml.XMLFile |
getConfigurationFile()
Returns the configuration template used to configure the repository.
|
java.lang.String |
getDefaultViewName()
Returns the name of the "default" or "root" RepositoryView
|
RepositoryItem |
getItem(java.lang.String pId)
Deprecated.
|
RepositoryItem |
getItem(java.lang.String pId,
java.lang.String pDescriptorName)
Returns an item in the Repository with the given id.
|
RepositoryItemDescriptor |
getItemDescriptor(RepositoryItemDescriptor pDesc)
Returns a RepositoryItemDescriptor accessed with the name of the given descriptor.
|
RepositoryItemDescriptor |
getItemDescriptor(java.lang.String pName)
Returns a RepositoryItemDescriptor accessed with the given name.
|
java.lang.String[] |
getItemDescriptorNames()
Returns an array of the names of the known RepositoryItemDescriptors.
|
RepositoryItem[] |
getItems(java.lang.String[] pIds)
Deprecated.
|
RepositoryItem[] |
getItems(java.lang.String[] pIds,
java.lang.String pDescriptorName)
Returns the items with the given ids.
|
int |
getQueryEndIndexFactor()
Returns the factor by which queries overshoot when trying to get enough results.
|
int |
getQueryMinimumQuerySize()
Returns the minimum guess size when querying with an end index.
|
Repository |
getRepository()
Returns the repository that we're wrapping.
|
java.lang.String |
getRepositoryDisplayName()
Get property
repositoryDisplayName |
java.lang.String |
getRepositoryDisplayNameResource()
Get property
repositoryDisplayNameResource |
java.lang.String |
getRepositoryName()
Returns the name of this Repository
|
SecurityConfiguration |
getSecurityConfiguration()
Returns the security configuration information for the repository.
|
SecurityPolicy |
getSecurityPolicy()
Returns the security policy used for the repository.
|
javax.transaction.TransactionManager |
getTransactionManager()
Returns the transaction manager to use for repository interaction.
|
RepositoryView |
getView(RepositoryItemDescriptor pDesc)
Returns a RepositoryView accessed with the name of the given descriptor.
|
RepositoryView |
getView(java.lang.String pName)
Returns a RepositoryView accessed with the given name.
|
java.lang.String[] |
getViewNames()
Returns an array of the names of all contained top-level views
|
java.util.Collection |
getWrappedRepositories()
Returns the repository that we're wrapping.
|
Repository |
getWrappedRepository()
Returns the repository that we're wrapping.
|
atg.xml.tools.XMLToolsFactory |
getXMLToolsFactory()
Returns the tools factory that creates an XML parser for this
user authority.
|
boolean |
hasAccess(java.lang.String pDescriptorName,
AccessRight pRight)
Checks to see if the current user has the indicated access
right for an item descriptor.
|
boolean |
isDisableSecurityEnhancements() |
void |
setComponentResourceBundleName(java.lang.String pComponentResourceBundleName)
Set property
componentResourceBundleName |
void |
setConfigurationFile(atg.xml.XMLFile pXmlConfiguration)
Changes the configuration template used to configure the repository.
|
void |
setDisableSecurityEnhancements(boolean pDisableSecurityEnhancements) |
void |
setQueryEndIndexFactor(int pQueryEndIndexFactor)
Sets the factor by which queries overshoot when trying to get enough results.
|
void |
setQueryMinimumQuerySize(int pQueryMinimumQuerySize)
Sets the minimum guess size when querying with an end index.
|
void |
setRepository(Repository pRepository)
Changes the repository that we're wrapping.
|
void |
setRepositoryDisplayNameResource(java.lang.String pRepositoryDisplayNameResource)
Set property
repositoryDisplayNameResource |
void |
setRepositoryName(java.lang.String pName)
Changes the name of the repository.
|
void |
setSecurityConfiguration(SecurityConfiguration pSecurityConfiguration)
Changes the security configuration for the repository, which affects
the production of access control lists.
|
void |
setTransactionManager(javax.transaction.TransactionManager pManager)
Changes the transaction manager to use for repository interaction.
|
void |
setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pNewFactory)
Sets the tools factory that will be used to create an XML parser for
this user authority.
|
java.lang.Object[] |
unwrapArray(java.lang.Object[] pArray)
Takes an array and removes the secured wrappers around its contents.
|
java.util.List |
unwrapList(java.util.List pList)
Takes a List and removes the secured wrappers around its contents.
|
java.util.Map |
unwrapMap(java.util.Map pMap)
Takes a Map and removes the secured wrappers around its contents.
|
java.util.Set |
unwrapSet(java.util.Set pSet)
Takes a Set and removes the secured wrappers around its contents.
|
java.lang.Object |
unwrapValue(java.lang.Object pValue)
Takes a secured repository property value and turns it into an unsecured
repository property value so we can store it in the underlying
repository.
|
RepositoryItem[] |
wrapItems(RepositoryItem[] pItems)
Wraps all repository items into a secured object returned from a query
|
addLogListener, createAdminServlet, 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 static java.lang.String CLASS_VERSION
protected Repository mRepository
protected javax.transaction.TransactionManager mTransactionManager
protected SecurityConfiguration mSecurityConfiguration
protected atg.adapter.secure.WeakItemCache mItemCache
public GenericSecuredRepository()
public GenericSecuredRepository(Repository pRepository, SecurityConfiguration pConfiguration)
public atg.xml.XMLFile getConfigurationFile()
public void setConfigurationFile(atg.xml.XMLFile pXmlConfiguration)
public boolean isDisableSecurityEnhancements()
public void setDisableSecurityEnhancements(boolean pDisableSecurityEnhancements)
pDisableSecurityEnhancements
- the disableSecurityEnhancements to setpublic Repository getRepository()
public Repository getWrappedRepository()
getWrappedRepository
in interface atg.repository.RepositoryWrapper
public java.util.Collection getWrappedRepositories()
getWrappedRepositories
in interface atg.repository.RepositoryWrapper
public void setRepository(Repository pRepository)
public void setRepositoryName(java.lang.String pName)
public void setSecurityConfiguration(SecurityConfiguration pSecurityConfiguration)
public javax.transaction.TransactionManager getTransactionManager()
public void setTransactionManager(javax.transaction.TransactionManager pManager)
public atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
public void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pNewFactory)
public java.lang.String getRepositoryDisplayName()
repositoryDisplayName
getRepositoryDisplayName
in interface atg.repository.DisplayableRepository
public void setRepositoryDisplayNameResource(java.lang.String pRepositoryDisplayNameResource)
repositoryDisplayNameResource
pRepositoryDisplayNameResource
- the name of the resource
that contains the display name for this repositorypublic java.lang.String getRepositoryDisplayNameResource()
repositoryDisplayNameResource
public void setComponentResourceBundleName(java.lang.String pComponentResourceBundleName)
componentResourceBundleName
pComponentResourceBundleName
- the name of the resource
bundle that holds the display name resourcepublic java.lang.String getComponentResourceBundleName()
componentResourceBundleName
public void checkAccess(java.lang.String pDescriptorName, AccessRight pRight) throws RepositoryException
RepositoryException
RepositorySecurityException
,
PermissionDeniedException
public boolean hasAccess(java.lang.String pDescriptorName, AccessRight pRight) throws RepositoryException
RepositoryException
protected void checkAccess(GenericSecuredRepositoryItem pItem, AccessRight pRight) throws RepositoryException
If the item is null, this completes successfully. This allows the caller to call through into the real repository to receive the appropriate repository exception.
RepositoryException
protected void checkAccess(java.lang.String pId, java.lang.String pDescriptorName, AccessRight pRight) throws RepositoryException
RepositoryException
public RepositoryItem[] filterItems(RepositoryItem[] pItems, AccessRight pRight)
public RepositoryItem[] wrapItems(RepositoryItem[] pItems)
public java.lang.Object[] unwrapArray(java.lang.Object[] pArray)
public java.util.List unwrapList(java.util.List pList)
public java.util.Map unwrapMap(java.util.Map pMap)
public java.util.Set unwrapSet(java.util.Set pSet)
public java.lang.Object unwrapValue(java.lang.Object pValue)
protected void checkForInvalidRepository() throws ServiceException
ServiceException
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic java.lang.String getRepositoryName()
getRepositoryName
in interface Repository
public RepositoryItem getItem(java.lang.String pId) throws RepositoryException
The caller must have READ access on the item descriptor or a RepositorySecurityException will be thrown. They must have LIST access on the item or null is returned.
getItem
in interface Repository
pId
- the id of the item to retrieveRepositoryException
- if there was an error while
attempting to return the RepositoryItempublic RepositoryItem getItem(java.lang.String pId, java.lang.String pDescriptorName) throws RepositoryException
The caller must have READ access on the item descriptor or a RepositorySecurityException will be thrown. They must have LIST access on the item or null is returned.
getItem
in interface Repository
pId
- the id of the item to retrievepDescriptorName
- the name of the item descriptor that contains
this item.RepositoryException
- if there was an error while
attempting to return the RepositoryItempublic RepositoryItem[] getItems(java.lang.String[] pIds) throws RepositoryException
The caller must have LIST access on each item that is requested or that item's slot will be set to null following this query.
getItems
in interface Repository
RepositoryException
- if there was an error while
attempting to return the RepositoryItemspublic RepositoryItem[] getItems(java.lang.String[] pIds, java.lang.String pDescriptorName) throws RepositoryException
The caller must have READ access on the item descriptor or a RepositorySecurityException will e thrown. They must have LIST access on each item or null is returned in the slots of the respective items.
getItems
in interface Repository
pIds
- the list of idspDescriptorName
- the item descriptor containing these idsRepositoryException
- if there was an error while
attempting to return the RepositoryItemspublic java.lang.String getDefaultViewName()
getDefaultViewName
in interface Repository
public java.lang.String[] getViewNames()
getViewNames
in interface Repository
getViewNames
in interface RepositoryViewContainer
public RepositoryView getView(java.lang.String pName) throws RepositoryException
getView
in interface Repository
getView
in interface RepositoryViewContainer
pName
- the name of the view to findRepositoryException
- if there was an error while
attempting to return the RepositoryViewpublic RepositoryView getView(RepositoryItemDescriptor pDesc) throws RepositoryException
Repository
getView
in interface Repository
pDesc
- the descriptor of the view to findRepositoryException
- if there was an error while
attempting to return the RepositoryViewpublic java.lang.String[] getItemDescriptorNames()
getItemDescriptorNames
in interface Repository
public RepositoryItemDescriptor getItemDescriptor(java.lang.String pName) throws RepositoryException
getItemDescriptor
in interface Repository
pName
- the name of the descriptor to findRepositoryException
- if there was an error while
attempting to return the RepositoryItemDescriptorpublic RepositoryItemDescriptor getItemDescriptor(RepositoryItemDescriptor pDesc) throws RepositoryException
Repository
getItemDescriptor
in interface Repository
pDesc
- the descriptor to findRepositoryException
- if there was an error while
attempting to return the RepositoryItemDescriptorpublic SecurityPolicy getSecurityPolicy()
getSecurityPolicy
in interface SecuredRepository
public SecurityConfiguration getSecurityConfiguration()
getSecurityConfiguration
in interface SecuredRepository
public int getQueryEndIndexFactor()
public void setQueryEndIndexFactor(int pQueryEndIndexFactor)
public int getQueryMinimumQuerySize()
public void setQueryMinimumQuerySize(int pQueryMinimumQuerySize)