| | |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.backends.jeb.EntryContainer; |
| | | import org.opends.server.backends.pluggable.SuffixContainer; |
| | | import org.opends.server.controls.GetEffectiveRightsRequestControl; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * The AciHandler class performs the main processing for the dseecompat |
| | | * package. |
| | | * The AciHandler class performs the main processing for the dseecompat package. |
| | | */ |
| | | public final class AciHandler extends |
| | | AccessControlHandler<DseeCompatAccessControlHandlerCfg> |
| | |
| | | * String used to indicate that the evaluating ACI had a all user |
| | | * attributes targetattr match (targetattr="*"). |
| | | */ |
| | | public static final String ALL_USER_ATTRS_MATCHED = |
| | | "allUserAttrsMatched"; |
| | | public static final String ALL_USER_ATTRS_MATCHED = "allUserAttrsMatched"; |
| | | |
| | | /** |
| | | * String used to save the original authorization entry in an |
| | |
| | | */ |
| | | public static final String ORIG_AUTH_ENTRY = "origAuthorizationEntry"; |
| | | |
| | | /** |
| | | * Attribute type corresponding to "aci" attribute. |
| | | */ |
| | | /** Attribute type corresponding to "aci" attribute. */ |
| | | static AttributeType aciType; |
| | | |
| | | /** |
| | | * Attribute type corresponding to global "ds-cfg-global-aci" |
| | | * attribute. |
| | | */ |
| | | /** Attribute type corresponding to global "ds-cfg-global-aci" attribute. */ |
| | | static AttributeType globalAciType; |
| | | |
| | | /** |
| | | * Attribute type corresponding to "debugsearchindex" attribute. |
| | | */ |
| | | /** Attribute type corresponding to "debugsearchindex" attribute. */ |
| | | private static AttributeType debugSearchIndex; |
| | | |
| | | /** |
| | | * DN corresponding to "debugsearchindex" attribute type. |
| | | */ |
| | | /** DN corresponding to "debugsearchindex" attribute type. */ |
| | | private static DN debugSearchIndexDN; |
| | | |
| | | /** |
| | |
| | | { |
| | | aciType = getAttributeType("aci"); |
| | | globalAciType = getAttributeType(ATTR_AUTHZ_GLOBAL_ACI); |
| | | debugSearchIndex = getAttributeType(EntryContainer.ATTR_DEBUG_SEARCH_INDEX); |
| | | debugSearchIndex = getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX); |
| | | refAttrType = getAttributeType(ATTR_REFERRAL_URL); |
| | | |
| | | try |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The list that holds that ACIs keyed by the DN of the entry holding |
| | | * the ACI. |
| | | */ |
| | | /** The list that holds that ACIs keyed by the DN of the entry holding the ACI. */ |
| | | private AciList aciList; |
| | | |
| | | /** |
| | | * The listener that handles ACI changes caused by LDAP operations, |
| | | * ACI decode failure alert logging and backend initialization ACI |
| | | * list adjustment. |
| | | * ACI decode failure alert logging and backend initialization ACI list adjustment. |
| | | */ |
| | | private AciListenerManager aciListenerMgr; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new DSEE-compatible access control handler. |
| | | */ |
| | | /** Creates a new DSEE-compatible access control handler. */ |
| | | public AciHandler() |
| | | { |
| | | // No implementation required. All initialization should be done in |
| | | // the intializeAccessControlHandler method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void filterEntry(Operation operation, |
| | | SearchResultEntry unfilteredEntry, SearchResultEntry filteredEntry) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeAccessControlHandler() |
| | | { |
| | | aciListenerMgr.finalizeListenerManager(); |
| | |
| | | DirectoryServer.deregisterSupportedControl(OID_GET_EFFECTIVE_RIGHTS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeAccessControlHandler( |
| | | DseeCompatAccessControlHandlerCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | DirectoryServer.registerSupportedControl(OID_GET_EFFECTIVE_RIGHTS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(DN entryDN, Operation op, Control control) |
| | | throws DirectoryException |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(ExtendedOperation operation) |
| | | { |
| | |
| | | return accessAllowed(container); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(LocalBackendAddOperation operation) |
| | | throws DirectoryException |
| | | { |
| | | AciContainer container = |
| | | new AciLDAPOperationContainer(operation, ACI_ADD); |
| | | if (!isAllowed(container, operation)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | // LDAP add needs a verify ACI syntax step in case any |
| | | // "aci" attribute types are being added. |
| | | return verifySyntax(operation.getEntryToAdd(), operation, container |
| | | .getClientDN()); |
| | | AciContainer container = new AciLDAPOperationContainer(operation, ACI_ADD); |
| | | return isAllowed(container, operation) |
| | | // LDAP add needs a verify ACI syntax step in case any |
| | | // "aci" attribute types are being added. |
| | | && verifySyntax(operation.getEntryToAdd(), operation, container.getClientDN()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(BindOperation bindOperation) |
| | | { |
| | |
| | | // original entry DN has export access. |
| | | if (rdnChangesAllowed && newSuperiorDN != null) |
| | | { |
| | | AciContainer container = |
| | | new AciLDAPOperationContainer(operation, ACI_EXPORT, operation |
| | | .getOriginalEntry()); |
| | | AciContainer container = new AciLDAPOperationContainer( |
| | | operation, ACI_EXPORT, operation.getOriginalEntry()); |
| | | if (!oldRDN.equals(newRDN)) |
| | | { |
| | | // The RDNs are not equal, skip the proxy check since it was |
| | |
| | | return rdnChangesAllowed; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(LocalBackendModifyOperation operation) |
| | | throws DirectoryException |
| | |
| | | return aciCheckMods(container, operation, skipAccessCheck(operation)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(SearchOperation searchOperation) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(Operation operation, Entry entry, |
| | | SearchFilter filter) throws DirectoryException |
| | |
| | | return testFilter(container, filter); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mayProxy(Entry proxyUser, Entry proxiedUser, |
| | | Operation op) |
| | | public boolean mayProxy(Entry proxyUser, Entry proxiedUser, Operation op) |
| | | { |
| | | if (skipAccessCheck(proxyUser)) |
| | | { |
| | |
| | | return accessAllowedEntry(container); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean maySend(DN dn, Operation operation, |
| | | SearchResultReference reference) |
| | | public boolean maySend(DN dn, Operation operation, SearchResultReference reference) |
| | | { |
| | | if (skipAccessCheck(operation)) |
| | | { |
| | |
| | | return accessAllowed(container); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean maySend(Operation operation, SearchResultEntry entry) |
| | | { |