opendj-server-legacy: added @Override + Autorefactor'ed comments
| | |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.server.config.server.GroupImplementationCfg; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.MemberList; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | |
| | | /** |
| | | * This class defines the set of methods that must be implemented by a |
| | |
| | | public abstract void initializeGroupImplementation(T configuration) |
| | | throws ConfigException, InitializationException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided configuration is acceptable for |
| | | * this group implementation. It should be possible to call this |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any necessary finalization that may be needed whenever |
| | | * this group implementation is taken out of service within the |
| | |
| | | // No implementation is required by default. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new group of this type based on the definition |
| | | * contained in the provided entry. This method must be designed so |
| | |
| | | public abstract Group<T> newInstance(ServerContext serverContext, Entry groupEntry) |
| | | throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a search filter that may be used to identify entries |
| | | * containing definitions for groups of this type in the Directory |
| | |
| | | public abstract SearchFilter getGroupDefinitionFilter() |
| | | throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided entry contains a valid definition |
| | | * for this type of group. |
| | |
| | | */ |
| | | public abstract boolean isGroupDefinition(Entry entry); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the DN of the entry that contains the definition for |
| | | * this group. |
| | |
| | | */ |
| | | public abstract DN getGroupDN(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the DN of the entry that contains the definition for |
| | | * this group. |
| | |
| | | */ |
| | | public abstract void setGroupDN(DN groupDN); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this group supports nesting other groups, such |
| | | * that the members of the nested groups will also be considered |
| | |
| | | */ |
| | | public abstract boolean supportsNestedGroups(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a list of the DNs of any nested groups whose members |
| | | * should be considered members of this group. |
| | |
| | | */ |
| | | public abstract List<DN> getNestedGroupDNs(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to add the provided group DN as a nested group within |
| | | * this group. The change should be committed to persistent storage |
| | |
| | | public abstract void addNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to remove the provided group as a nested group within |
| | | * this group. The change should be committed to persistent storage |
| | |
| | | public abstract void removeNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the user with the specified DN is a member of |
| | | * this group. Note that this is a point-in-time determination and |
| | |
| | | return userDN != null && isMember(userDN, new HashSet<DN>()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the user with the specified DN is a member of |
| | | * this group. Note that this is a point-in-time determination and |
| | |
| | | public abstract boolean isMember(DN userDN, Set<DN> examinedGroups) |
| | | throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the user described by the provided user entry |
| | | * is a member of this group. Note that this is a point-in-time |
| | |
| | | return isMember(userEntry, new HashSet<DN>()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the user described by the provided user entry |
| | | * is a member of this group. Note that this is a point-in-time |
| | |
| | | Set<DN> examinedGroups) |
| | | throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an iterator that may be used to cursor through the |
| | | * entries of the members contained in this group. Note that this |
| | |
| | | return getMembers(null, null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an iterator that may be used to cursor through the |
| | | * entries of the members contained in this group. It may |
| | |
| | | SearchFilter filter) |
| | | throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether it is possible to alter the member list for |
| | | * this group (e.g., in order to add members to the group or remove |
| | |
| | | */ |
| | | public abstract boolean mayAlterMemberList(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempt to make multiple changes to the group's member list. |
| | | * |
| | |
| | | public abstract void updateMembers(List<Modification> modifications) |
| | | throws UnsupportedOperationException, DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to add the provided user as a member of this group. The |
| | | * change should be committed to persistent storage through an |
| | |
| | | public abstract void addMember(Entry userEntry) |
| | | throws UnsupportedOperationException, DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to remove the specified user as a member of this group. |
| | | * The change should be committed to persistent storage through an |
| | |
| | | public abstract void removeMember(DN userDN) |
| | | throws UnsupportedOperationException, DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a string representation of this group. |
| | | * |
| | | * @return A string representation of this group. |
| | | */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this group to the provided |
| | | * buffer. |
| | |
| | | */ |
| | | public abstract void toString(StringBuilder buffer); |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This interface defines a set of methods that must be implemented by |
| | | * any class that forms the basis for a protocol element (e.g., an |
| | |
| | | */ |
| | | @org.opends.server.types.PublicAPI( |
| | | stability=org.opends.server.types.StabilityLevel.VOLATILE, |
| | | mayInstantiate=false, |
| | | mayExtend=true, |
| | | mayInvoke=true) |
| | | public interface ProtocolElement |
| | | { |
| | | /** |
| | | * Retrieves the name of the protocol associated with this protocol |
| | | * element. |
| | | * Retrieves the name of the protocol associated with this protocol element. |
| | | * |
| | | * @return The name of the protocol associated with this protocol |
| | | * element. |
| | | * @return The name of the protocol associated with this protocol element. |
| | | */ |
| | | String getProtocolElementName(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a string representation of this protocol element. |
| | | * |
| | | * @return A string representation of this protocol element. |
| | | */ |
| | | String toString(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this protocol element to the |
| | | * provided buffer. |
| | |
| | | */ |
| | | void toString(StringBuilder buffer); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this protocol element to the |
| | | * provided buffer. |
| | |
| | | */ |
| | | void toString(StringBuilder buffer, int indent); |
| | | } |
| | | |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | |
| | | public abstract class InternalDirectoryServerPlugin extends |
| | | DirectoryServerPlugin<PluginCfg> |
| | | { |
| | | |
| | | /** |
| | | * Creates a new internal directory server plugin using the provided |
| | | * component name and plugin types. |
| | |
| | | invokeForInternalOps); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void initializePlugin(Set<PluginType> pluginTypes, |
| | | PluginCfg configuration) throws ConfigException, |
| | | InitializationException |
| | |
| | | // Unused. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final boolean isConfigurationAcceptable( |
| | | PluginCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | // Unused. |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import static org.opends.messages.AccessControlMessages.*; |
| | | import java.util.regex.Pattern; |
| | | import java.util.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * This class represents a single ACI's IP bind rule expression. It is possible |
| | |
| | | * address for each IP address parsed from the bind rule. |
| | | */ |
| | | public class IP implements KeywordBindRule { |
| | | |
| | | /** |
| | | * Regular expression used to do a quick check on the characters in a |
| | | * bind rule address. These are all of the valid characters that may |
| | | * appear in an bind rule address part. |
| | | */ |
| | | private static final String ipRegEx = |
| | | "((?i)[\\.{1}[a-f]\\d:\\+{1}\\*/{1}\\t\\[{1}\\]{1}]+(?-i))"; |
| | | private static final Pattern ipRegEx = |
| | | Pattern.compile("((?i)[\\.{1}[a-f]\\d:\\+{1}\\*/{1}\\t\\[{1}\\]{1}]+(?-i))"); |
| | | |
| | | /** |
| | | * List of the pattern classes, one for each address decoded from the bind |
| | | * rule. |
| | | */ |
| | | /** List of the pattern classes, one for each address decoded from the bind rule. */ |
| | | private List<PatternIP> patternIPList; |
| | | |
| | | /** The type of the bind rule (!= or =). */ |
| | | private EnumBindRuleType type; |
| | | |
| | |
| | | String[] ipStrs=expr.split("\\,", -1); |
| | | List<PatternIP> patternIPList= new LinkedList<>(); |
| | | for (String ipStr : ipStrs) { |
| | | if (!Pattern.matches(ipRegEx, ipStr)) { |
| | | LocalizableMessage message = |
| | | WARN_ACI_SYNTAX_INVALID_IP_EXPRESSION.get(expr); |
| | | throw new AciException(message); |
| | | if (!ipRegEx.matcher(ipStr).matches()) { |
| | | throw new AciException(WARN_ACI_SYNTAX_INVALID_IP_EXPRESSION.get(expr)); |
| | | } |
| | | PatternIP ipPattern = PatternIP.decode(ipStr); |
| | | patternIPList.add(ipPattern); |
| | | patternIPList.add(PatternIP.decode(ipStr)); |
| | | } |
| | | return new IP(patternIPList, type); |
| | | } |
| | |
| | | * |
| | | * @return An enumeration representing if the address matched. |
| | | */ |
| | | @Override |
| | | public EnumEvalResult evaluate(AciEvalContext evalCtx) { |
| | | InetAddress remoteAddr=evalCtx.getRemoteAddress(); |
| | | return evaluate(remoteAddr); |
| | | return evaluate(evalCtx.getRemoteAddress()); |
| | | } |
| | | |
| | | /** |
| | |
| | | return matched.getRet(type, false); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder sb = new StringBuilder(); |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) { |
| | | buffer.append(super.toString()); |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.AccessControlMessages.*; |
| | | |
| | | /** |
| | | * The class represents the ssf keyword in a bind rule.SSF stands for |
| | | * security strength factor. |
| | | */ |
| | | public class SSF implements KeywordBindRule { |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** The class represents the ssf keyword in a bind rule.SSF stands for security strength factor. */ |
| | | public class SSF implements KeywordBindRule { |
| | | /** Enumeration representing the bind rule operation type. */ |
| | | private EnumBindRuleType type; |
| | | |
| | |
| | | * @return An evaluation result enumeration containing the result of the |
| | | * context evaluation. |
| | | */ |
| | | @Override |
| | | public EnumEvalResult evaluate(AciEvalContext evalCtx) { |
| | | int currentSSF = evalCtx.getCurrentSSF(); |
| | | EnumEvalResult matched = getMatched(currentSSF); |
| | |
| | | return EnumEvalResult.FALSE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append(super.toString()); |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import static org.opends.messages.AccessControlMessages.*; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * This class represents the timeofday keyword in a bind rule. |
| | | */ |
| | | public class TimeOfDay implements KeywordBindRule { |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | /** |
| | | * Regular expression matching a valid timeofday rule value (0-2359). |
| | | */ |
| | | private static final String timeofdayRegex = "[0-2]\\d[0-5]\\d"; |
| | | /** This class represents the timeofday keyword in a bind rule. */ |
| | | public class TimeOfDay implements KeywordBindRule { |
| | | /** Regular expression matching a valid timeofday rule value (0-2359). */ |
| | | private static final Pattern timeofdayRegex = Pattern.compile("[0-2]\\d[0-5]\\d"); |
| | | |
| | | /** Enumeration representing the bind rule operation type. */ |
| | | private EnumBindRuleType type; |
| | |
| | | public static TimeOfDay decode(String expr, EnumBindRuleType type) |
| | | throws AciException { |
| | | int valueAsInt = 0; |
| | | if (!Pattern.matches(timeofdayRegex, expr)) |
| | | if (!timeofdayRegex.matcher(expr).matches()) |
| | | { |
| | | LocalizableMessage message = WARN_ACI_SYNTAX_INVALID_TIMEOFDAY.get(expr); |
| | | throw new AciException(message); |
| | |
| | | * @return An enumeration result representing the result of the |
| | | * evaluation. |
| | | */ |
| | | @Override |
| | | public EnumEvalResult evaluate(AciEvalContext evalCtx) { |
| | | EnumEvalResult matched=EnumEvalResult.FALSE; |
| | | |
| | |
| | | return matched.getRet(type, false); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append(super.toString()); |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | | * This class implements the Sun-defined account usable request control. The |
| | |
| | | public class AccountUsableRequestControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<AccountUsableRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AccountUsableRequestControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | return new AccountUsableRequestControl(isCritical); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_ACCOUNT_USABLE_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<AccountUsableRequestControl> DECODER = |
| | | new Decoder(); |
| | | |
| | | /** |
| | | * Creates a new instance of the account usable request control with the |
| | | * default settings. |
| | | */ |
| | | /** Creates a new instance of the account usable request control with the default settings. */ |
| | | public AccountUsableRequestControl() |
| | | { |
| | | this(false); |
| | |
| | | public AccountUsableRequestControl(boolean isCritical) |
| | | { |
| | | super(OID_ACCOUNT_USABLE_CONTROL, isCritical); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | // No value element. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this account usable request control to |
| | | * the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("AccountUsableRequestControl()"); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | | * This class implements the account usable response control. This is a |
| | |
| | | public class AccountUsableResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<AccountUsableResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AccountUsableResponseControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_ACCOUNT_USABLE_CONTROL; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | public static final ControlDecoder<AccountUsableResponseControl> DECODER = |
| | | new Decoder(); |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<AccountUsableResponseControl> DECODER = new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the seconds before expiration when the account is |
| | | * available. |
| | | */ |
| | | /** The BER type to use for the seconds before expiration when the account is available. */ |
| | | public static final byte TYPE_SECONDS_BEFORE_EXPIRATION = (byte) 0x80; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO sequence when the account is not |
| | | * available. |
| | | */ |
| | | /** The BER type to use for the MORE_INFO sequence when the account is not available. */ |
| | | public static final byte TYPE_MORE_INFO = (byte) 0xA1; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO element that indicates that the |
| | | * account has been inactivated. |
| | | */ |
| | | public static final byte TYPE_INACTIVE = (byte) 0x80; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO element that indicates that the |
| | | * password has been administratively reset. |
| | | */ |
| | | public static final byte TYPE_RESET = (byte) 0x81; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO element that indicates that the |
| | | * user's password is expired. |
| | | */ |
| | | public static final byte TYPE_EXPIRED = (byte) 0x82; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO element that provides the number of |
| | | * remaining grace logins. |
| | | */ |
| | | public static final byte TYPE_REMAINING_GRACE_LOGINS = (byte) 0x83; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO element that indicates that the |
| | | * password has been administratively reset. |
| | |
| | | public static final byte TYPE_SECONDS_BEFORE_UNLOCK = (byte) 0x84; |
| | | |
| | | |
| | | |
| | | /** Indicates whether the user's account is usable. */ |
| | | private boolean isUsable; |
| | | |
| | | /** Indicates whether the user's password is expired. */ |
| | | private boolean isExpired; |
| | | |
| | | /** Indicates whether the user's account is inactive. */ |
| | | private boolean isInactive; |
| | | |
| | | /** Indicates whether the user's account is currently locked. */ |
| | | private boolean isLocked; |
| | | |
| | | /** |
| | | * Indicates whether the user's password has been reset and must be changed |
| | | * before anything else can be done. |
| | |
| | | |
| | | /** The number of remaining grace logins, if available. */ |
| | | private int remainingGraceLogins; |
| | | |
| | | /** |
| | | * The length of time in seconds before the user's password expires, if |
| | | * available. |
| | | */ |
| | | /** The length of time in seconds before the user's password expires, if available. */ |
| | | private int secondsBeforeExpiration; |
| | | |
| | | /** The length of time before the user's account is unlocked, if available. */ |
| | | private int secondsBeforeUnlock; |
| | | |
| | |
| | | isLocked, secondsBeforeUnlock); |
| | | } |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | |
| | | return secondsBeforeUnlock; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this password policy response control to |
| | | * the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("AccountUsableResponseControl(isUsable="); |
| | |
| | | public class AuthorizationIdentityResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<AuthorizationIdentityResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AuthorizationIdentityResponseControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_AUTHZID_RESPONSE; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<AuthorizationIdentityResponseControl> |
| | | DECODER = new Decoder(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeOctetString(authorizationID); |
| | | } |
| | |
| | | return authorizationID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this authorization identity response |
| | | * control to the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("AuthorizationIdentityResponseControl(authzID=\""); |
| | |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | | * This class implements the entry change notification control defined in |
| | |
| | | public class EntryChangeNotificationControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<EntryChangeNotificationControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public EntryChangeNotificationControl decode( |
| | | boolean isCritical, ByteString value) throws DirectoryException |
| | | { |
| | |
| | | previousDN, changeNumber); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_ENTRY_CHANGE_NOTIFICATION; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The ControlDecoder that can be used to decode this control. |
| | | */ |
| | | /** The ControlDecoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<EntryChangeNotificationControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | this(false, changeType, previousDN, changeNumber); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes this control value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | |
| | | return changeNumber; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this entry change notification control |
| | | * to the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("EntryChangeNotificationControl(changeType="); |
| | |
| | | buffer.append(")"); |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.ERR_ECLN_CANNOT_DECODE_VALUE; |
| | | import static org.opends.messages.ProtocolMessages.ERR_ECLN_NO_CONTROL_VALUE; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class implements the ECL cookie control. |
| | | * It may be included in entries returned in response to a search or |
| | |
| | | /** The cookie value - payload of this control. */ |
| | | private String cookie; |
| | | |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<EntryChangelogNotificationControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public EntryChangelogNotificationControl decode( |
| | | boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | |
| | | return new EntryChangelogNotificationControl(isCritical, cookie); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_ECL_COOKIE_EXCHANGE_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<EntryChangelogNotificationControl> |
| | | DECODER = new Decoder(); |
| | | |
| | |
| | | this.cookie = cookie; |
| | | } |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) |
| | | * must be written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(); |
| | |
| | | return cookie; |
| | | } |
| | | |
| | | /** |
| | | * Appends a string representation of this entry change notification control |
| | | * to the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("EntryChangelogNotificationControl(cookie="); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.SearchFilter; |
| | | |
| | | |
| | | /** |
| | | * This class implements the LDAP assertion request control as defined in RFC |
| | |
| | | public class LDAPAssertionRequestControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<LDAPAssertionRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDAPAssertionRequestControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | return new LDAPAssertionRequestControl(isCritical, filter); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_LDAP_ASSERTION; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<LDAPAssertionRequestControl> DECODER = |
| | | new Decoder(); |
| | | |
| | |
| | | filter = null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | |
| | | { |
| | | filter = rawFilter.toSearchFilter(); |
| | | } |
| | | |
| | | return filter; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this LDAP assertion request control to |
| | | * the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | buffer.append("\")"); |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | */ |
| | | public class LDAPPostReadRequestControl extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder implements |
| | | ControlDecoder<LDAPPostReadRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDAPPostReadRequestControl decode(boolean isCritical, |
| | | ByteString value) throws DirectoryException |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_LDAP_READENTRY_POSTREAD; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<LDAPPostReadRequestControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class LDAPPostReadResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<LDAPPostReadResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDAPPostReadResponseControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | return new LDAPPostReadResponseControl(isCritical, searchEntry); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_LDAP_READENTRY_POSTREAD; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<LDAPPostReadResponseControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | this.searchEntry = searchEntry; |
| | | } |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | */ |
| | | public class LDAPPreReadRequestControl extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder implements |
| | | ControlDecoder<LDAPPreReadRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDAPPreReadRequestControl decode(boolean isCritical, |
| | | ByteString value) throws DirectoryException |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_LDAP_READENTRY_PREREAD; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<LDAPPreReadRequestControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class LDAPPreReadResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<LDAPPreReadResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDAPPreReadResponseControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | return new LDAPPreReadResponseControl(isCritical, searchEntry); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_LDAP_READENTRY_PREREAD; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<LDAPPreReadResponseControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | this.searchEntry = searchEntry; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | |
| | | public class MatchedValuesControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<MatchedValuesControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MatchedValuesControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_MATCHED_VALUES; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<MatchedValuesControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | this.filters = filters; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this authorization identity response |
| | | * control to the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | */ |
| | | public class PagedResultsControl extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<PagedResultsControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PagedResultsControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | return new PagedResultsControl(isCritical, size, cookie); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_PAGED_RESULTS_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<PagedResultsControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | private int size; |
| | | |
| | | |
| | | /** |
| | | * The control value cookie element. |
| | | */ |
| | | /** The control value cookie element. */ |
| | | private ByteString cookie; |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class PasswordExpiredControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<PasswordExpiredControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordExpiredControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | return new PasswordExpiredControl(isCritical); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_NS_PASSWORD_EXPIRED; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<PasswordExpiredControl> DECODER = |
| | | new Decoder(); |
| | | |
| | | /** |
| | | * Creates a new instance of the password expired control with the default |
| | | * settings. |
| | | */ |
| | | /** Creates a new instance of the password expired control with the default settings. */ |
| | | public PasswordExpiredControl() |
| | | { |
| | | this(false); |
| | |
| | | super(OID_NS_PASSWORD_EXPIRED, isCritical); |
| | | } |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeOctetString("0"); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class PasswordExpiringControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<PasswordExpiringControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordExpiringControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | secondsUntilExpiration); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_NS_PASSWORD_EXPIRING; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<PasswordExpiringControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | this.secondsUntilExpiration = secondsUntilExpiration; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeOctetString(String.valueOf(secondsUntilExpiration)); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class PasswordPolicyRequestControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<PasswordPolicyRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordPolicyRequestControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | return new PasswordPolicyRequestControl(isCritical); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_PASSWORD_POLICY_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<PasswordPolicyRequestControl> DECODER = |
| | | new Decoder(); |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of the password policy request control with the |
| | | * default settings. |
| | | */ |
| | | /** Creates a new instance of the password policy request control with the default settings. */ |
| | | public PasswordPolicyRequestControl() |
| | | { |
| | | this(false); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes this control's value to an ASN.1 writer. The value (if any) must be |
| | | * written as an ASN1OctetString. |
| | | * |
| | | * @param writer The ASN.1 output stream to write to. |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | // No value element. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this password policy request control to |
| | | * the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class PasswordPolicyResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<PasswordPolicyResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordPolicyResponseControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_ACCOUNT_USABLE_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<PasswordPolicyResponseControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type value for the warning element of the control value. |
| | | */ |
| | | /** The BER type value for the warning element of the control value. */ |
| | | public static final byte TYPE_WARNING_ELEMENT = (byte) 0xA0; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type value for the error element of the control value. |
| | | */ |
| | | /** The BER type value for the error element of the control value. */ |
| | | public static final byte TYPE_ERROR_ELEMENT = (byte) 0x81; |
| | | |
| | | |
| | |
| | | return errorType; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this password policy response control to |
| | | * the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class PersistentSearchControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<PersistentSearchControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PersistentSearchControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | changeTypes, changesOnly, returnECs); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_PERSISTENT_SEARCH; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<PersistentSearchControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | public class ProxiedAuthV1Control |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<ProxiedAuthV1Control> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ProxiedAuthV1Control decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<ProxiedAuthV1Control> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | public class ProxiedAuthV2Control |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<ProxiedAuthV2Control> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ProxiedAuthV2Control decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<ProxiedAuthV2Control> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this proxied authorization v2 control |
| | | * to the provided buffer. |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | public class ServerSideSortRequestControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * The BER type to use when encoding the orderingRule element. |
| | | */ |
| | | /** The BER type to use when encoding the orderingRule element. */ |
| | | private static final byte TYPE_ORDERING_RULE_ID = (byte) 0x80; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use when encoding the reverseOrder element. |
| | | */ |
| | | /** The BER type to use when encoding the reverseOrder element. */ |
| | | private static final byte TYPE_REVERSE_ORDER = (byte) 0x81; |
| | | |
| | | |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<ServerSideSortRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ServerSideSortRequestControl decode(boolean isCritical, |
| | | ByteString value) |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<ServerSideSortRequestControl> DECODER = |
| | | new Decoder(); |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class ServerSideSortResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<ServerSideSortResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ServerSideSortResponseControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_SERVER_SIDE_SORT_RESPONSE_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<ServerSideSortResponseControl> DECODER = |
| | | new Decoder(); |
| | | |
| | | /** |
| | | * The BER type to use when encoding the attribute type element. |
| | | */ |
| | | /** The BER type to use when encoding the attribute type element. */ |
| | | private static final byte TYPE_ATTRIBUTE_TYPE = (byte) 0x80; |
| | | |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class SubentriesControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<SubentriesControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SubentriesControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | return new SubentriesControl(isCritical, visibility); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_LDAP_SUBENTRIES; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<SubentriesControl> DECODER = |
| | | new Decoder(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | */ |
| | | public class SubtreeDeleteControl extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a |
| | | * ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder implements |
| | | ControlDecoder<SubtreeDeleteControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SubtreeDeleteControl decode(boolean isCritical, |
| | | ByteString value) throws DirectoryException |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_SUBTREE_DELETE_CONTROL; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<SubtreeDeleteControl> DECODER = |
| | | new Decoder(); |
| | | |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class VLVRequestControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<VLVRequestControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public VLVRequestControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_VLV_REQUEST_CONTROL; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<VLVRequestControl> DECODER = |
| | | new Decoder(); |
| | | |
| | | /** |
| | | * The BER type to use when encoding the byOffset target element. |
| | | */ |
| | | /** The BER type to use when encoding the byOffset target element. */ |
| | | public static final byte TYPE_TARGET_BYOFFSET = (byte) 0xA0; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The BER type to use when encoding the greaterThanOrEqual target element. |
| | | */ |
| | | /** The BER type to use when encoding the greaterThanOrEqual target element. */ |
| | | public static final byte TYPE_TARGET_GREATERTHANOREQUAL = (byte) 0x81; |
| | | |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | public class VLVResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | /** ControlDecoder implementation to decode this control from a ByteString. */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<VLVResponseControl> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public VLVResponseControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return OID_VLV_RESPONSE_CONTROL; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The Control Decoder that can be used to decode this control. |
| | | */ |
| | | /** The Control Decoder that can be used to decode this control. */ |
| | | public static final ControlDecoder<VLVResponseControl> DECODER = |
| | | new Decoder(); |
| | | |
| | |
| | | PreParseAbandonOperation, |
| | | PostOperationAbandonOperation |
| | | { |
| | | |
| | | /** The message ID of the operation that should be abandoned. */ |
| | | private final int idToAbandon; |
| | | |
| | | |
| | | /** |
| | | * Creates a new abandon operation with the provided information. |
| | | * |
| | |
| | | { |
| | | super(clientConnection, operationID, messageID, requestControls); |
| | | |
| | | |
| | | this.idToAbandon = idToAbandon; |
| | | this.cancelResult = new CancelResult(ResultCode.CANNOT_CANCEL, |
| | | ERR_CANNOT_CANCEL_ABANDON.get()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the message ID of the operation that should be abandoned. |
| | | * |
| | |
| | | return idToAbandon; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | |
| | | return OperationType.ABANDON; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<Control> getResponseControls() |
| | | { |
| | |
| | | return NO_RESPONSE_CONTROLS; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | // An abandon operation can never have a response, so just ignore this. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | | // An abandon operation can never have a response, so just ignore this. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs the work of actually processing this operation. This |
| | | * should include all processing for the operation, including |
| | |
| | | // code to reflect whether the abandon was successful and an error message |
| | | // if it was not. Even though there is no response, the result should |
| | | // still be logged. |
| | | // |
| | | // Even though it is technically illegal to send a response for |
| | | // operations that have been abandoned, it may be a good idea to do so |
| | | // to ensure that the requestor isn't left hanging. This will be a |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Stop the processing timer. |
| | | setProcessingStopTime(); |
| | | |
| | | |
| | | // Log the result of the abandon operation. |
| | | logAbandonResult(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2013 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | /** |
| | | * This abstract class wraps/decorates a given abandon operation. This class |
| | | * will be extended by sub-classes to enhance the functionality of the |
| | |
| | | public abstract class AbandonOperationWrapper extends |
| | | OperationWrapper<AbandonOperation> implements AbandonOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new abandon operation wrapper based on the provided abandon |
| | | * operation. |
| | |
| | | super(abandon); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getIDToAbandon() |
| | | { |
| | | return getOperation().getIDToAbandon(); |
| | | } |
| | | |
| | | } |
| | |
| | | ConfigurationAddListener <AccountStatusNotificationHandlerCfg>, |
| | | ConfigurationDeleteListener <AccountStatusNotificationHandlerCfg> |
| | | { |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated |
| | | * notification handlers. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated notification handlers. */ |
| | | private final ConcurrentHashMap<DN,AccountStatusNotificationHandler> notificationHandlers; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | notificationHandlers = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all account status notification handlers currently defined in |
| | | * the Directory Server configuration. This should only be called at |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | AccountStatusNotificationHandlerCfg configuration, |
| | |
| | | return status; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AccountStatusNotificationHandlerCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | AccountStatusNotificationHandlerCfg configuration, |
| | |
| | | return status; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | AccountStatusNotificationHandlerCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | AccountStatusNotificationHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | AccountStatusNotificationHandlerCfg configuration |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a notification handler, |
| | | * and optionally initializes that instance. Any initialized notification |
| | |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a notification handler, |
| | | * and optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove a notification handler that has been installed in the server. |
| | | * |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | DN getProxiedAuthorizationDN(); |
| | | |
| | | /** |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | void setProxiedAuthorizationDN(DN proxiedAuthorizationDN); |
| | | |
| | | } |
| | |
| | | public abstract class AddOperationWrapper extends |
| | | OperationWrapper<AddOperation> implements AddOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new add operation based on the provided add operation. |
| | | * |
| | |
| | | super(add); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addObjectClass(ObjectClass objectClass, String name) |
| | | { |
| | | getOperation().addObjectClass(objectClass, name); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addRawAttribute(RawAttribute rawAttribute) |
| | | { |
| | | getOperation().addRawAttribute(rawAttribute); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN() |
| | | { |
| | | return getOperation().getEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Map<ObjectClass, String> getObjectClasses() |
| | | { |
| | | return getOperation().getObjectClasses(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Map<AttributeType, List<Attribute>> getOperationalAttributes() |
| | | { |
| | | return getOperation().getOperationalAttributes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<RawAttribute> getRawAttributes() |
| | | { |
| | | return getOperation().getRawAttributes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawEntryDN() |
| | | { |
| | | return getOperation().getRawEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Map<AttributeType, List<Attribute>> getUserAttributes() |
| | | { |
| | | return getOperation().getUserAttributes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeAttribute(AttributeType attributeType) |
| | | { |
| | | getOperation().removeAttribute(attributeType); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeObjectClass(ObjectClass objectClass) |
| | | { |
| | | getOperation().removeObjectClass(objectClass); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAttribute(AttributeType attributeType, |
| | | List<Attribute> attributeList) |
| | |
| | | getOperation().setAttribute(attributeType, attributeList); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawAttributes(List<RawAttribute> rawAttributes) |
| | | { |
| | | getOperation().setRawAttributes(rawAttributes); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | getOperation().setRawEntryDN(rawEntryDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return getOperation().toString(); |
| | | } |
| | | |
| | | } |
| | |
| | | implements ConfigurationChangeListener<AlertHandlerCfg>, |
| | | ConfigurationAddListener<AlertHandlerCfg>, |
| | | ConfigurationDeleteListener<AlertHandlerCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** A mapping between the DNs of the config entries and the associated alert handlers. */ |
| | |
| | | rootConfiguration.addAlertHandlerAddListener(this); |
| | | rootConfiguration.addAlertHandlerDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing alert handlers. |
| | | for (String name : rootConfiguration.listAlertHandlers()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable(AlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(AlertHandlerCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | AlertHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | AlertHandlerCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(AlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AlertHandlerCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing alert handler if it's already enabled. |
| | | AlertHandler<?> existingHandler = alertHandlers.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the handler disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the alert handler. If the handler is already enabled, |
| | | // then we shouldn't do anything with it although if the class has changed |
| | | // then we'll at least need to indicate that administrative action is |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as an alert handler, and |
| | | * optionally initializes that instance. |
| | |
| | | implements ConfigurationChangeListener<AttributeSyntaxCfg>, |
| | | ConfigurationAddListener<AttributeSyntaxCfg>, |
| | | ConfigurationDeleteListener<AttributeSyntaxCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated |
| | | * attribute syntaxes. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated attribute syntaxes. */ |
| | | private ConcurrentHashMap<DN,AttributeSyntax> syntaxes; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | syntaxes = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all attribute syntaxes currently defined in the Directory |
| | | * Server configuration. This should only be called at Directory Server |
| | |
| | | rootConfiguration.addAttributeSyntaxAddListener(this); |
| | | rootConfiguration.addAttributeSyntaxDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing attribute syntaxes. |
| | | for (String name : rootConfiguration.listAttributeSyntaxes()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | AttributeSyntaxCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | AttributeSyntaxCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | AttributeSyntaxCfg configuration, |
| | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | AttributeSyntaxCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | AttributeSyntaxCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(AttributeSyntaxCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing syntax if it's already enabled. |
| | | AttributeSyntax<?> existingSyntax = syntaxes.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the syntax disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the attribute syntax. If the syntax is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as an attribute syntax, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** The SASL mechanism used for SASL authentication. */ |
| | | private String saslMechanism; |
| | | |
| | | /** |
| | | * A string representation of the protocol version for this bind operation. |
| | | */ |
| | | /** A string representation of the protocol version for this bind operation. */ |
| | | private String protocolVersion; |
| | | |
| | | /** |
| | |
| | | cancelResult = getBindCancelResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new SASL bind operation with the provided information. |
| | | * |
| | |
| | | cancelResult = getBindCancelResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new SASL bind operation with the provided information. |
| | | * |
| | |
| | | return new CancelResult(CANNOT_CANCEL, ERR_CANNOT_CANCEL_BIND.get()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final AuthenticationType getAuthenticationType() |
| | | { |
| | | return authType; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getRawBindDN() |
| | | { |
| | | return rawBindDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setRawBindDN(ByteString rawBindDN) |
| | | { |
| | |
| | | return simplePassword; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setSimplePassword(ByteString simplePassword) |
| | | { |
| | |
| | | saslCredentials = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final String getSASLMechanism() |
| | | { |
| | | return saslMechanism; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getSASLCredentials() |
| | | { |
| | | return saslCredentials; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setSASLCredentials(String saslMechanism, |
| | | ByteString saslCredentials) |
| | |
| | | simplePassword = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getServerSASLCredentials() |
| | | { |
| | | return serverSASLCredentials; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setServerSASLCredentials(ByteString serverSASLCredentials) |
| | | { |
| | | this.serverSASLCredentials = serverSASLCredentials; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final Entry getSASLAuthUserEntry() |
| | | { |
| | | return saslAuthUserEntry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setSASLAuthUserEntry(Entry saslAuthUserEntry) |
| | | { |
| | | this.saslAuthUserEntry = saslAuthUserEntry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final LocalizableMessage getAuthFailureReason() |
| | | { |
| | | return authFailureReason; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setAuthFailureReason(LocalizableMessage message) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final DN getUserEntryDN() |
| | | { |
| | | return userEntryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final AuthenticationInfo getAuthenticationInfo() |
| | | { |
| | | return authInfo; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setAuthenticationInfo(AuthenticationInfo authInfo) |
| | | { |
| | | this.authInfo = authInfo; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | |
| | | return OperationType.BIND; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | responseControls.add(control); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | | responseControls.remove(control); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | |
| | | buffer.append(")"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setUserEntryDN(DN userEntryDN) |
| | | { |
| | | this.userEntryDN = userEntryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getProtocolVersion() |
| | | { |
| | | return protocolVersion; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProtocolVersion(String protocolVersion) |
| | | { |
| | | this.protocolVersion = protocolVersion; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | |
| | | CancelRequest cancelRequest = new CancelRequest(true, cancelReason); |
| | | clientConnection.cancelAllOperationsExcept(cancelRequest, getMessageID()); |
| | | |
| | | |
| | | // This flag is set to true as soon as a workflow has been executed. |
| | | boolean workflowExecuted = false; |
| | | try |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Process the bind DN to convert it from the raw form as provided by the |
| | | // client into the form required for the rest of the bind processing. |
| | | DN bindDN = getBindDN(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateOperationErrMsgAndResCode() |
| | | { |
| | |
| | | super(bind); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AuthenticationInfo getAuthenticationInfo() |
| | | { |
| | | return getOperation().getAuthenticationInfo(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AuthenticationType getAuthenticationType() |
| | | { |
| | | return getOperation().getAuthenticationType(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getAuthFailureReason() |
| | | { |
| | | return getOperation().getAuthFailureReason(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getBindDN() |
| | | { |
| | | return getOperation().getBindDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawBindDN() |
| | | { |
| | | return getOperation().getRawBindDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getSASLAuthUserEntry() |
| | | { |
| | | return getOperation().getSASLAuthUserEntry(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getSASLCredentials() |
| | | { |
| | | return getOperation().getSASLCredentials(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getSASLMechanism() |
| | | { |
| | | return getOperation().getSASLMechanism(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getServerSASLCredentials() |
| | | { |
| | | return getOperation().getServerSASLCredentials(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getSimplePassword() |
| | | { |
| | | return getOperation().getSimplePassword(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getUserEntryDN() |
| | | { |
| | | return getOperation().getUserEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAuthenticationInfo(AuthenticationInfo authInfo) |
| | | { |
| | | getOperation().setAuthenticationInfo(authInfo); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAuthFailureReason(LocalizableMessage reason) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawBindDN(ByteString rawBindDN) |
| | | { |
| | | getOperation().setRawBindDN(rawBindDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setSASLAuthUserEntry(Entry saslAuthUserEntry) |
| | | { |
| | | getOperation().setSASLAuthUserEntry(saslAuthUserEntry); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setSASLCredentials(String saslMechanism, |
| | | ByteString saslCredentials) |
| | |
| | | getOperation().setSASLCredentials(saslMechanism, saslCredentials); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setServerSASLCredentials(ByteString serverSASLCredentials) |
| | | { |
| | | getOperation().setServerSASLCredentials(serverSASLCredentials); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setSimplePassword(ByteString simplePassword) |
| | | { |
| | | getOperation().setSimplePassword(simplePassword); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setUserEntryDN(DN userEntryDN){ |
| | | getOperation().setUserEntryDN(userEntryDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return getOperation().toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProtocolVersion(String protocolVersion) |
| | | { |
| | | getOperation().setProtocolVersion(protocolVersion); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getProtocolVersion() |
| | | { |
| | | return getOperation().getProtocolVersion(); |
| | | } |
| | | |
| | | } |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2013-2014 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | */ |
| | | public class BoundedWorkQueueStrategy implements QueueingStrategy |
| | | { |
| | | |
| | | /** |
| | | * The number of concurrently running operations for this |
| | | * BoundedWorkQueueStrategy. |
| | | */ |
| | | /** The number of concurrently running operations for this BoundedWorkQueueStrategy. */ |
| | | private final AtomicInteger nbRunningOperations = new AtomicInteger(0); |
| | | /** Maximum number of concurrent operations. 0 means "unlimited". */ |
| | | private final int maxNbConcurrentOperations; |
| | |
| | | return DirectoryServer.getWorkQueue().getNumWorkerThreads(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void enqueueRequest(final Operation operation) |
| | | throws DirectoryException |
| | |
| | | implements ConfigurationChangeListener<CertificateMapperCfg>, |
| | | ConfigurationAddListener<CertificateMapperCfg>, |
| | | ConfigurationDeleteListener<CertificateMapperCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated |
| | | * certificate mappers. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated certificate mappers. */ |
| | | private ConcurrentHashMap<DN,CertificateMapper> certificateMappers; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addCertificateMapperAddListener(this); |
| | | rootConfiguration.addCertificateMapperDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing certificate mappers. |
| | | for (String mapperName : rootConfiguration.listCertificateMappers()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | CertificateMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | CertificateMapperCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | CertificateMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | CertificateMapperCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CertificateMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CertificateMapperCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing mapper if it's already enabled. |
| | | CertificateMapper existingMapper = |
| | | certificateMappers.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the mapper disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the certificate mapper. If the mapper is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a certificate mapper, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | ConfigurationChangeListener<ConnectionHandlerCfg> { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** |
| | | * The mapping between configuration entry DNs and their corresponding |
| | | * connection handler implementations. |
| | |
| | | connectionHandlers = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ConnectionHandlerCfg configuration) { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ConnectionHandlerCfg configuration) { |
| | |
| | | .deregisterConnectionHandler(connectionHandler); |
| | | connectionHandlers.remove(dn); |
| | | |
| | | |
| | | connectionHandler.finalizeConnectionHandler( |
| | | INFO_CONNHANDLER_CLOSED_BY_DISABLE.get()); |
| | | } |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ConnectionHandlerCfg configuration) { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes the configuration associated with the Directory |
| | | * Server connection handlers. This should only be called at |
| | |
| | | |
| | | initializeAdministrationConnectorConfig(); |
| | | |
| | | |
| | | RootCfg root = serverContext.getRootConfig(); |
| | | root.addConnectionHandlerAddListener(this); |
| | | root.addConnectionHandlerDeleteListener(this); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void initializeAdministrationConnectorConfig() |
| | | throws ConfigException, InitializationException { |
| | | AdministrationConnectorCfg administrationConnectorCfg = |
| | |
| | | DirectoryServer.registerConnectionHandler(connectionHandler); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | ConnectionHandlerCfg configuration, |
| | |
| | | || isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ConnectionHandlerCfg configuration, |
| | |
| | | || isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | ConnectionHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** Load and initialize the connection handler named in the config. */ |
| | | private <T extends ConnectionHandlerCfg> ConnectionHandler<T> getConnectionHandler( |
| | | T config) throws ConfigException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determines whether or not the new configuration's implementation |
| | | * class is acceptable. |
| | | */ |
| | | /** Determines whether or not the new configuration's implementation class is acceptable. */ |
| | | private boolean isJavaClassAcceptable( |
| | | ConnectionHandlerCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) { |
| | |
| | | class DefaultAccessControlHandler |
| | | extends AccessControlHandler<AccessControlHandlerCfg> |
| | | { |
| | | /** |
| | | * Create a new default access control handler. |
| | | */ |
| | | /** Create a new default access control handler. */ |
| | | public DefaultAccessControlHandler() |
| | | { |
| | | super(); |
| | |
| | | // No implementation required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeAccessControlHandler(AccessControlHandlerCfg |
| | | configuration) |
| | |
| | | // No implementation required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeAccessControlHandler() |
| | | { |
| | | // No implementation required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(LocalBackendAddOperation addOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(BindOperation bindOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(LocalBackendCompareOperation compareOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(LocalBackendDeleteOperation deleteOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(ExtendedOperation extendedOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(LocalBackendModifyOperation modifyOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(DN dn, Operation op, Control control) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(ModifyDNOperation modifyDNOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(SearchOperation searchOperation) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAllowed(Operation operation, Entry entry, |
| | | SearchFilter filter) throws DirectoryException |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean maySend(Operation operation, SearchResultEntry unfilteredEntry) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void filterEntry(Operation operation, |
| | | SearchResultEntry unfilteredEntry, SearchResultEntry filteredEntry) |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean maySend(DN dn, Operation operation, |
| | | SearchResultReference searchReference) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mayProxy(Entry proxyUser, Entry proxiedUser, |
| | | Operation operation) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | /** Synchronizes calls to save. */ |
| | | private final Object saveLock = new Object(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this compressed schema manager. |
| | | * |
| | |
| | | load(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void storeAttribute(final byte[] encodedAttribute, |
| | | final String attributeName, final Iterable<String> attributeOptions) |
| | |
| | | save(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void storeObjectClasses(final byte[] encodedObjectClasses, |
| | | final Collection<String> objectClassNames) throws DirectoryException |
| | |
| | | save(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the compressed schema information from disk. |
| | | */ |
| | | /** Loads the compressed schema information from disk. */ |
| | | private void load() |
| | | { |
| | | FileInputStream inputStream = null; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes the compressed schema information to disk. |
| | | * |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | DN getProxiedAuthorizationDN(); |
| | | |
| | | /** |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | void setProxiedAuthorizationDN(DN proxiedAuthorizationDN); |
| | | |
| | | |
| | |
| | | public abstract class DeleteOperationWrapper extends |
| | | OperationWrapper<DeleteOperation> implements DeleteOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new delete operation based on the provided delete operation. |
| | | * |
| | |
| | | super(delete); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN() |
| | | { |
| | | return getOperation().getEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawEntryDN() |
| | | { |
| | | return getOperation().getRawEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | getOperation().setRawEntryDN(rawEntryDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return getOperation().toString(); |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | /** |
| | | * Invokes the shutdown hook to signal the Directory Server to stop running. |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | logger.trace( |
| | |
| | | this.serverContext = serverContext; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes the default entry cache. |
| | | * This should only be called at Directory Server startup. |
| | |
| | | stackTraceToSingleLineString(e)); |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes the configuration associated with the Directory Server entry |
| | | * cache. This should only be called at Directory Server startup. If an |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | EntryCacheCfg configuration, |
| | |
| | | return status; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | EntryCacheCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | EntryCacheCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(EntryCacheCfg configuration) |
| | | { |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | EntryCacheCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | EntryCacheCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as an entry cache, |
| | | * and optionally initializes that instance. Any initialize entry |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import org.opends.server.types.operation.PreOperationExtendedOperation; |
| | | import org.opends.server.types.operation.PreParseExtendedOperation; |
| | | |
| | | /** |
| | | * This class defines an extended operation, which can perform virtually any |
| | | * kind of task. |
| | | */ |
| | | /** This class defines an extended operation, which can perform virtually any kind of task. */ |
| | | public class ExtendedOperationBasis |
| | | extends AbstractOperation |
| | | implements ExtendedOperation, |
| | |
| | | /** The OID for the response associated with this extended operation. */ |
| | | private String responseOID; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new extended operation with the provided information. |
| | | * |
| | |
| | | { |
| | | super(clientConnection, operationID, messageID, requestControls); |
| | | |
| | | |
| | | this.requestOID = requestOID; |
| | | this.requestValue = requestValue; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final String getRequestOID() |
| | | { |
| | | return requestOID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the OID for the request associated with this extended operation. |
| | | * This should only be called by pre-parse plugins. |
| | |
| | | this.requestOID = requestOID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getRequestValue() |
| | | { |
| | | return requestValue; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the value for the request associated with this extended |
| | | * operation. This should only be called by pre-parse plugins. |
| | |
| | | this.requestValue = requestValue; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final String getResponseOID() |
| | | { |
| | | return responseOID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setResponseOID(String responseOID) |
| | | { |
| | | this.responseOID = responseOID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getResponseValue() |
| | | { |
| | | return responseValue; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setResponseValue(ByteString responseValue) |
| | | { |
| | | this.responseValue = responseValue; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | |
| | | return OperationType.EXTENDED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | responseControls.add(control); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | | responseControls.remove(control); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs the work of actually processing this operation. This |
| | | * should include all processing for the operation, including |
| | |
| | | |
| | | checkIfCanceled(false); |
| | | |
| | | |
| | | // Get the extended operation handler for the request OID. If there is |
| | | // none, then fail. |
| | | ExtendedOperationHandler<?> handler = |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Look at the controls included in the request and ensure that all |
| | | // critical controls are supported by the handler. |
| | | for (Iterator<Control> iter = getRequestControls().iterator(); iter.hasNext();) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Check to see if the client has permission to perform the |
| | | // extended operation. |
| | | |
| | |
| | | |
| | | // Actually perform the processing for this operation. |
| | | handler.processExtendedOperation(this); |
| | | |
| | | } |
| | | finally |
| | | { |
| | | getPluginConfigManager().invokePostOperationExtendedPlugins(this); |
| | | } |
| | | |
| | | } |
| | | catch(CanceledOperationException coe) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ExtendedOperationHandlerCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ExtendedOperationHandlerCfg configuration, |
| | |
| | | || isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ExtendedOperationHandlerCfg configuration) |
| | |
| | | // Put this handler in the hash so that we will |
| | | // be able to find it if it is altered. |
| | | handlers.put(dn, handler); |
| | | |
| | | } catch (ConfigException e) { |
| | | logger.traceException(e); |
| | | |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | ExtendedOperationHandlerCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ExtendedOperationHandlerCfg configuration) |
| | |
| | | // Put this connection handler in the hash so that we will be |
| | | // able to find it if it is altered. |
| | | handlers.put(dn, handler); |
| | | |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | ExtendedOperationHandlerCfg configuration, |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determines whether or not the new configuration's implementation |
| | | * class is acceptable. |
| | | */ |
| | | /** Determines whether or not the new configuration's implementation class is acceptable. */ |
| | | private boolean isJavaClassAcceptable(ExtendedOperationHandlerCfg config, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | public abstract class ExtendedOperationWrapper extends |
| | | OperationWrapper<ExtendedOperation> implements ExtendedOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new extended operation wrapper based on the provided extended |
| | | * operation. |
| | |
| | | super(extended); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getRequestOID() |
| | | { |
| | | return getOperation().getRequestOID(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getResponseOID() |
| | | { |
| | | return getOperation().getResponseOID(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRequestValue() |
| | | { |
| | | return getOperation().getRequestValue(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getResponseValue() |
| | | { |
| | | return getOperation().getResponseValue(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setResponseOID(String responseOID) |
| | | { |
| | | getOperation().setResponseOID(responseOID); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setResponseValue(ByteString responseValue) |
| | | { |
| | | getOperation().setResponseValue(responseValue); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** |
| | | * Used by group instances to determine if new groups have been registered or |
| | | * groups deleted. |
| | | */ |
| | | /** Used by group instances to determine if new groups have been registered or groups deleted. */ |
| | | private volatile long refreshToken; |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated group |
| | | * implementations. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated group implementations. */ |
| | | private ConcurrentMap<DN, Group<?>> groupImplementations; |
| | | |
| | | /** |
| | | * A mapping between the DNs of all group entries and the corresponding group |
| | | * instances. |
| | | */ |
| | | /** A mapping between the DNs of all group entries and the corresponding group instances. */ |
| | | private DITCacheMap<Group<?>> groupInstances; |
| | | |
| | | /** Lock to protect internal data structures. */ |
| | |
| | | DirectoryServer.registerBackendInitializationListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all group implementations currently defined in the Directory |
| | | * Server configuration. This should only be called at Directory Server |
| | |
| | | rootConfiguration.addGroupImplementationAddListener(this); |
| | | rootConfiguration.addGroupImplementationDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing group implementations. |
| | | for (String name : rootConfiguration.listGroupImplementations()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | GroupImplementationCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | GroupImplementationCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | GroupImplementationCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | GroupImplementationCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | GroupImplementationCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | GroupImplementationCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the group implementation. If the group is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a group implementation, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any cleanup work that may be needed when the server is shutting |
| | | * down. |
| | | */ |
| | | /** Performs any cleanup work that may be needed when the server is shutting down. */ |
| | | public void finalizeGroupManager() |
| | | { |
| | | DirectoryServer.deregisterInternalPlugin(this); |
| | |
| | | groupImplementations.clear(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an {@code Iterable} object that may be used to cursor across the |
| | | * group implementations defined in the server. |
| | |
| | | return groupImplementations.values(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an {@code Iterable} object that may be used to cursor across the |
| | | * group instances defined in the server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the group instance defined in the entry with the specified DN. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} In this case, the server will search the backend to find |
| | | * all group instances that it may contain and register them with this group |
| | |
| | | continue; |
| | | } |
| | | |
| | | |
| | | for (DN baseDN : backend.getBaseDNs()) |
| | | { |
| | | try |
| | |
| | | continue; |
| | | } |
| | | |
| | | |
| | | SearchRequest request = newSearchRequest(baseDN, SearchScope.WHOLE_SUBTREE, filter) |
| | | .addControl(control); |
| | | InternalSearchOperation internalSearch = |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} In this case, the server will de-register all group |
| | | * instances associated with entries in the provided backend. |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | |
| | | /** |
| | | * In this case, each entry is checked to see if it contains |
| | | * a group definition, and if so it will be instantiated and |
| | |
| | | createAndRegisterGroup(entry); |
| | | } |
| | | |
| | | |
| | | |
| | | private static boolean hasGroupMembershipUpdateControl(PluginOperation operation) |
| | | { |
| | | List<Control> requestControls = operation.getRequestControls(); |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * In this case, if the entry is associated with a registered |
| | | * group instance, then that group instance will be deregistered. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Scan the list of provided modifications looking for any changes to the objectClass, |
| | | * which might change the entry to another kind of group, or even to a non-group. |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * In this case, if the entry is associated with a registered |
| | | * group instance, then that instance will be recreated from |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * In this case, if the entry is associated with a registered |
| | | * group instance, then that instance will be recreated from |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostOperation doPostOperation( |
| | | PostOperationAddOperation addOperation) |
| | |
| | | return PluginResult.PostOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostOperation doPostOperation( |
| | | PostOperationDeleteOperation deleteOperation) |
| | |
| | | return PluginResult.PostOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostOperation doPostOperation( |
| | | PostOperationModifyOperation modifyOperation) |
| | |
| | | return PluginResult.PostOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostOperation doPostOperation( |
| | | PostOperationModifyDNOperation modifyDNOperation) |
| | |
| | | return PluginResult.PostOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostSynchronization( |
| | | PostSynchronizationAddOperation addOperation) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostSynchronization( |
| | | PostSynchronizationDeleteOperation deleteOperation) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostSynchronization( |
| | | PostSynchronizationModifyOperation modifyOperation) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostSynchronization( |
| | | PostSynchronizationModifyDNOperation modifyDNOperation) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to create a group instance from the provided entry, and if that is |
| | | * successful then register it with the server, overwriting any existing |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes all group instances that might happen to be registered with the |
| | | * group manager. This method is only intended for testing purposes and |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Compare the specified token against the current group manager |
| | | * token value. Can be used to reload cached group instances if there has |
| | |
| | | return this.refreshToken; |
| | | } |
| | | } |
| | | |
| | |
| | | implements ConfigurationChangeListener<IdentityMapperCfg>, |
| | | ConfigurationAddListener<IdentityMapperCfg>, |
| | | ConfigurationDeleteListener<IdentityMapperCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** A mapping between the DNs of the config entries and the associated identity mappers. */ |
| | |
| | | identityMappers = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all identity mappers currently defined in the Directory Server |
| | | * configuration. This should only be called at Directory Server startup. |
| | |
| | | rootConfiguration.addIdentityMapperAddListener(this); |
| | | rootConfiguration.addIdentityMapperDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing identity mappers. |
| | | for (String mapperName : rootConfiguration.listIdentityMappers()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Now that all of the identity mappers are defined, see if the Directory |
| | | // Server's proxied auth mapper is valid. If not, then log a warning |
| | | // message. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | IdentityMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | IdentityMapperCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | IdentityMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | IdentityMapperCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | IdentityMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | IdentityMapperCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing mapper if it's already enabled. |
| | | IdentityMapper existingMapper = identityMappers.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the mapper disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the identity mapper. If the mapper is already enabled, |
| | | // then we shouldn't do anything with it although if the class has changed |
| | | // then we'll at least need to indicate that administrative action is |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as an identity mapper, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | /** The debug log tracer for this object. */ |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** Shutdown monitor state. */ |
| | | private volatile boolean shutdownRequested; |
| | | private final Object shutdownLock = new Object(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this idle time limit thread. |
| | | */ |
| | | /** Creates a new instance of this idle time limit thread. */ |
| | | public IdleTimeLimitThread() |
| | | { |
| | | super("Idle Time Limit Thread"); |
| | |
| | | DirectoryServer.registerShutdownListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Operates in a loop, teriminating any client connections that have been idle |
| | | * for too long. |
| | | */ |
| | | /** Operates in a loop, teriminating any client connections that have been idle for too long. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | LocalizableMessage disconnectMessage = INFO_IDLETIME_LIMIT_EXCEEDED.get(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getShutdownListenerName() |
| | | { |
| | | return "Idle Time Limit Thread"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) |
| | | { |
| | | synchronized (shutdownLock) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | implements ConfigurationChangeListener<KeyManagerProviderCfg>, |
| | | ConfigurationAddListener<KeyManagerProviderCfg>, |
| | | ConfigurationDeleteListener<KeyManagerProviderCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated key |
| | | * manager providers. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated key manager providers. */ |
| | | private final ConcurrentHashMap<DN,KeyManagerProvider> providers; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addKeyManagerProviderAddListener(this); |
| | | rootConfiguration.addKeyManagerProviderDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing key manager providers. |
| | | for (String name : rootConfiguration.listKeyManagerProviders()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | KeyManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | KeyManagerProviderCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | KeyManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | KeyManagerProviderCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | KeyManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | KeyManagerProviderCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing provider if it's already enabled. |
| | | KeyManagerProvider existingProvider = providers.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the provider disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the key manager provider. If the provider is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a key manager provider, and |
| | | * optionally initializes that instance. |
| | |
| | | propertyDefinition.loadClass(className, KeyManagerProvider.class); |
| | | KeyManagerProvider provider = providerClass.newInstance(); |
| | | |
| | | |
| | | if (initialize) |
| | | { |
| | | provider.initializeKeyManagerProvider(configuration); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | implements ConfigurationChangeListener<MatchingRuleCfg>, |
| | | ConfigurationAddListener<MatchingRuleCfg>, |
| | | ConfigurationDeleteListener<MatchingRuleCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated matching |
| | | * rule Factories. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated matching rule Factories. */ |
| | | private ConcurrentHashMap<DN, MatchingRuleFactory<?>> matchingRuleFactories; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | matchingRuleFactories = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all matching rules after reading all the Matching Rule |
| | | * factories currently defined in the Directory Server configuration. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable(MatchingRuleCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(MatchingRuleCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable(MatchingRuleCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete(MatchingRuleCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(MatchingRuleCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | MatchingRuleCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing matching rule factory if it's already enabled. |
| | | MatchingRuleFactory<?> existingFactory = |
| | | matchingRuleFactories.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the matching rule disabled, then disable it |
| | | // if it is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the matching rule. If the matching rule is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as an attribute syntax, and |
| | | * optionally initializes that instance. |
| | |
| | | * |
| | | * @return The raw, unprocessed entry DN as included in the client request. |
| | | */ |
| | | @Override |
| | | ByteString getRawEntryDN(); |
| | | |
| | | /** |
| | |
| | | * @return The DN of the entry to rename, or <CODE>null</CODE> if the raw |
| | | * entry DN has not yet been processed. |
| | | */ |
| | | @Override |
| | | DN getEntryDN(); |
| | | |
| | | /** |
| | |
| | | * @return The raw, unprocessed newRDN as included in the request from the |
| | | * client. |
| | | */ |
| | | @Override |
| | | ByteString getRawNewRDN(); |
| | | |
| | | /** |
| | |
| | | * @return The new RDN to use for the entry, or <CODE>null</CODE> if the raw |
| | | * newRDN has not yet been processed. |
| | | */ |
| | | @Override |
| | | RDN getNewRDN(); |
| | | |
| | | |
| | |
| | | * @return <CODE>true</CODE> if the current RDN value should be removed from |
| | | * the entry, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | boolean deleteOldRDN(); |
| | | |
| | | /** |
| | |
| | | * @return The raw, unprocessed newSuperior from the client request, or |
| | | * <CODE>null</CODE> if there is none. |
| | | */ |
| | | @Override |
| | | ByteString getRawNewSuperior(); |
| | | |
| | | /** |
| | |
| | | * no newSuperior DN for this request or if the raw newSuperior has |
| | | * not yet been processed. |
| | | */ |
| | | @Override |
| | | DN getNewSuperior(); |
| | | |
| | | /** |
| | |
| | | * @return The current entry, or <CODE>null</CODE> if it is not yet |
| | | * available. |
| | | */ |
| | | @Override |
| | | Entry getOriginalEntry(); |
| | | |
| | | |
| | |
| | | * @return The updated entry, or <CODE>null</CODE> if it is not yet |
| | | * available. |
| | | */ |
| | | @Override |
| | | Entry getUpdatedEntry(); |
| | | |
| | | /** |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | DN getProxiedAuthorizationDN(); |
| | | |
| | | |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | void setProxiedAuthorizationDN(DN dn); |
| | | |
| | | } |
| | |
| | | /** Indicates whether to delete the old RDN value from the entry. */ |
| | | private boolean deleteOldRDN; |
| | | |
| | | /** |
| | | * The raw, unprocessed current DN of the entry as included in the request |
| | | * from the client. |
| | | */ |
| | | /** The raw, unprocessed current DN of the entry as included in the request from the client. */ |
| | | private ByteString rawEntryDN; |
| | | |
| | | /** The raw, unprocessed newRDN as included in the request from the client. */ |
| | | private ByteString rawNewRDN; |
| | | |
| | | /** |
| | | * The raw, unprocessed newSuperior as included in the request from the |
| | | * client. |
| | | */ |
| | | /** The raw, unprocessed newSuperior as included in the request from the client. */ |
| | | private ByteString rawNewSuperior; |
| | | |
| | | /** The current DN of the entry. */ |
| | |
| | | { |
| | | super(clientConnection, operationID, messageID, requestControls); |
| | | |
| | | |
| | | this.rawEntryDN = rawEntryDN; |
| | | this.rawNewRDN = rawNewRDN; |
| | | this.deleteOldRDN = deleteOldRDN; |
| | |
| | | modifications = null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new modify DN operation with the provided information. |
| | | * |
| | |
| | | { |
| | | super(clientConnection, operationID, messageID, requestControls); |
| | | |
| | | |
| | | this.entryDN = entryDN; |
| | | this.newRDN = newRDN; |
| | | this.deleteOldRDN = deleteOldRDN; |
| | |
| | | modifications = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getRawEntryDN() |
| | | { |
| | | return rawEntryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | |
| | | return rawNewRDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setRawNewRDN(ByteString rawNewRDN) |
| | | { |
| | |
| | | newDN = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final RDN getNewRDN() |
| | | { |
| | |
| | | return newRDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final boolean deleteOldRDN() |
| | | { |
| | | return deleteOldRDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setDeleteOldRDN(boolean deleteOldRDN) |
| | | { |
| | | this.deleteOldRDN = deleteOldRDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getRawNewSuperior() |
| | | { |
| | | return rawNewSuperior; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void setRawNewSuperior(ByteString rawNewSuperior) |
| | | { |
| | |
| | | return modifications; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void addModification(Modification modification) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final Entry getOriginalEntry() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final Entry getUpdatedEntry() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | |
| | | return OperationType.MODIFY_DN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return proxiedAuthorizationDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | responseControls.add(control); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | | responseControls.remove(control); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Performs the work of actually processing this operation. This |
| | | * should include all processing for the operation, including |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Invokes the post response plugins. If a workflow has been executed |
| | | * then invoke the post response plugins provided by the workflow |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateOperationErrMsgAndResCode() |
| | | { |
| | |
| | | appendErrorMessage(ERR_MODDN_NO_BACKEND_FOR_CURRENT_ENTRY.get(entryDN)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | |
| | | buffer.append(")"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN dn) |
| | | { |
| | | proxiedAuthorizationDN = dn; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getNewDN() |
| | | { |
| | |
| | | } |
| | | return newDN; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | public abstract class ModifyDNOperationWrapper extends |
| | | OperationWrapper<ModifyDNOperation> implements ModifyDNOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new moddn operation based on the provided moddn operation. |
| | | * |
| | |
| | | super(modifyDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addModification(Modification modification) { |
| | | getOperation().addModification(modification); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean deleteOldRDN() { |
| | | return getOperation().deleteOldRDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN() { |
| | | return getOperation().getEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Modification> getModifications() { |
| | | return getOperation().getModifications(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public RDN getNewRDN() { |
| | | return getOperation().getNewRDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getNewSuperior() { |
| | | return getOperation().getNewSuperior(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getOriginalEntry() { |
| | | return getOperation().getOriginalEntry(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawEntryDN() { |
| | | return getOperation().getRawEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawNewRDN() { |
| | | return getOperation().getRawNewRDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawNewSuperior() { |
| | | return getOperation().getRawNewSuperior(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getUpdatedEntry() { |
| | | return getOperation().getUpdatedEntry(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDeleteOldRDN(boolean deleteOldRDN) { |
| | | getOperation().setDeleteOldRDN(deleteOldRDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawEntryDN(ByteString rawEntryDN) { |
| | | getOperation().setRawEntryDN(rawEntryDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawNewRDN(ByteString rawNewRDN) { |
| | | getOperation().setRawNewRDN(rawNewRDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawNewSuperior(ByteString rawNewSuperior) { |
| | | getOperation().setRawNewSuperior(rawNewSuperior); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getNewDN() |
| | | { |
| | | return getOperation().getNewDN(); |
| | | } |
| | | |
| | | } |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | DN getProxiedAuthorizationDN(); |
| | | |
| | | /** |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | void setProxiedAuthorizationDN(DN proxiedAuthorizationDN); |
| | | |
| | | } |
| | |
| | | public abstract class ModifyOperationWrapper extends |
| | | OperationWrapper<ModifyOperation> implements ModifyOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new modify operation based on the provided modify operation. |
| | | * |
| | |
| | | super(modify); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addModification(Modification modification) |
| | | throws DirectoryException |
| | |
| | | getOperation().addModification(modification); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addRawModification(RawModification rawModification) |
| | | { |
| | | getOperation().addRawModification(rawModification); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN() |
| | | { |
| | | return getOperation().getEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Modification> getModifications() |
| | | { |
| | | return getOperation().getModifications(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawEntryDN() |
| | | { |
| | | return getOperation().getRawEntryDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<RawModification> getRawModifications() |
| | | { |
| | | return getOperation().getRawModifications(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | getOperation().setRawEntryDN(rawEntryDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawModifications(List<RawModification> rawModifications) |
| | | { |
| | | getOperation().setRawModifications(rawModifications); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return getOperation().toString(); |
| | | } |
| | | |
| | | } |
| | |
| | | implements ConfigurationChangeListener<MonitorProviderCfg>, |
| | | ConfigurationAddListener<MonitorProviderCfg>, |
| | | ConfigurationDeleteListener<MonitorProviderCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated monitor |
| | | * providers. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated monitor providers. */ |
| | | private final ConcurrentHashMap<DN,MonitorProvider<?>> monitors; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addMonitorProviderAddListener(this); |
| | | rootConfiguration.addMonitorProviderDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing monitor providers. |
| | | for (String name : rootConfiguration.listMonitorProviders()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | MonitorProviderCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | MonitorProviderCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | MonitorProviderCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | MonitorProviderCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | MonitorProviderCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | MonitorProviderCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the monitor provider. If the monitor is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a monitor provider, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** The wrapped operation. */ |
| | | private W operation; |
| | | |
| | | |
| | | /** |
| | | * Creates a new generic operation wrapper. |
| | | * |
| | |
| | | this.operation = operation; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addRequestControl(Control control) |
| | | { |
| | | operation.addRequestControl(control); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addResponseControl(Control control) |
| | | { |
| | | operation.addResponseControl(control); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void appendErrorMessage(LocalizableMessage message) |
| | | { |
| | | operation.appendErrorMessage(message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void appendMaskedErrorMessage(LocalizableMessage maskedMessage) |
| | | { |
| | | operation.appendMaskedErrorMessage(maskedMessage); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public CancelResult cancel(CancelRequest cancelRequest) |
| | | { |
| | | return operation.cancel(cancelRequest); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void abort(CancelRequest cancelRequest) |
| | | { |
| | | operation.abort(cancelRequest); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void disconnectClient( |
| | | DisconnectReason disconnectReason, |
| | |
| | | disconnectReason, sendNotification, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean dontSynchronize() |
| | | { |
| | | return operation.dontSynchronize(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> T getAttachment(String name) |
| | | { |
| | | return operation.getAttachment(name); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Map<String, Object> getAttachments() |
| | | { |
| | | return operation.getAttachments(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getAuthorizationDN() |
| | | { |
| | | return operation.getAuthorizationDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getAuthorizationEntry() |
| | | { |
| | | return operation.getAuthorizationEntry(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return operation.getProxiedAuthorizationDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | operation.setProxiedAuthorizationDN(proxiedAuthorizationDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public CancelRequest getCancelRequest() |
| | | { |
| | | return operation.getCancelRequest(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public CancelResult getCancelResult() |
| | | { |
| | | return operation.getCancelResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ClientConnection getClientConnection() |
| | | { |
| | | return operation.getClientConnection(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getConnectionID() |
| | | { |
| | | return operation.getConnectionID(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessageBuilder getErrorMessage() |
| | | { |
| | | return operation.getErrorMessage(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessageBuilder getMaskedErrorMessage() |
| | | { |
| | | return operation.getMaskedErrorMessage(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ResultCode getMaskedResultCode() |
| | | { |
| | | return operation.getMaskedResultCode(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getMatchedDN() |
| | | { |
| | | return operation.getMatchedDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getMessageID() |
| | | { |
| | |
| | | return operation; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getOperationID() |
| | | { |
| | | return operation.getOperationID(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public OperationType getOperationType() |
| | | { |
| | | return operation.getOperationType(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getProcessingStartTime() |
| | | { |
| | | return operation.getProcessingStartTime(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getProcessingStopTime() |
| | | { |
| | | return operation.getProcessingStopTime(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getProcessingTime() |
| | | { |
| | | return operation.getProcessingTime(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getProcessingNanoTime() |
| | | { |
| | | return operation.getProcessingNanoTime(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<String> getReferralURLs() |
| | | { |
| | | return operation.getReferralURLs(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Control> getRequestControls() |
| | | { |
| | | return operation.getRequestControls(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T extends Control> T getRequestControl( |
| | | ControlDecoder<T> d)throws DirectoryException |
| | |
| | | return operation.getRequestControl(d); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Control> getResponseControls() |
| | | { |
| | | return operation.getResponseControls(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ResultCode getResultCode() |
| | | { |
| | | return operation.getResultCode(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isInnerOperation() |
| | | { |
| | | return operation.isInnerOperation(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isInternalOperation() |
| | | { |
| | | return operation.isInternalOperation(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSynchronizationOperation() |
| | | { |
| | | return operation.isSynchronizationOperation(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void operationCompleted() |
| | | { |
| | | operation.operationCompleted(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> T removeAttachment(String name) |
| | | { |
| | | return operation.removeAttachment(name); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeResponseControl(Control control) |
| | | { |
| | | operation.removeResponseControl(control); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> T setAttachment(String name, Object value) |
| | | { |
| | | return operation.setAttachment(name, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAttachments(Map<String, Object> attachments) |
| | | { |
| | | operation.setAttachments(attachments); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAuthorizationEntry(Entry authorizationEntry) |
| | | { |
| | | operation.setAuthorizationEntry(authorizationEntry); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDontSynchronize(boolean dontSynchronize) |
| | | { |
| | | operation.setDontSynchronize(dontSynchronize); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setErrorMessage(LocalizableMessageBuilder errorMessage) |
| | | { |
| | | operation.setErrorMessage(errorMessage); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInnerOperation(boolean isInnerOperation) |
| | | { |
| | | operation.setInnerOperation(isInnerOperation); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInternalOperation(boolean isInternalOperation) |
| | | { |
| | | operation.setInternalOperation(isInternalOperation); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setMaskedErrorMessage(LocalizableMessageBuilder maskedErrorMessage) |
| | | { |
| | | operation.setMaskedErrorMessage(maskedErrorMessage); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setMaskedResultCode(ResultCode maskedResultCode) |
| | | { |
| | | operation.setMaskedResultCode(maskedResultCode); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setMatchedDN(DN matchedDN) |
| | | { |
| | | operation.setMatchedDN(matchedDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setReferralURLs(List<String> referralURLs) |
| | | { |
| | | operation.setReferralURLs(referralURLs); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setResponseData(DirectoryException directoryException) |
| | | { |
| | | operation.setResponseData(directoryException); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setResultCode(ResultCode resultCode) |
| | | { |
| | | operation.setResultCode(resultCode); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setSynchronizationOperation(boolean isSynchronizationOperation) |
| | | { |
| | | operation.setSynchronizationOperation(isSynchronizationOperation); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final int hashCode() |
| | | { |
| | | return getClientConnection().hashCode() * (int) getOperationID(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final boolean equals(Object obj) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return "Wrapped " + operation; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | operation.toString(buffer); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | final synchronized public void checkIfCanceled(boolean signalTooLate) |
| | | throws CanceledOperationException { |
| | | operation.checkIfCanceled(signalTooLate); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void registerPostResponseCallback(Runnable callback) |
| | | { |
| | | operation.registerPostResponseCallback(callback); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | operation.run(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<AdditionalLogItem> getAdditionalLogItems() |
| | | { |
| | | return operation.getAdditionalLogItems(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addAdditionalLogItem(AdditionalLogItem item) |
| | | { |
| | | operation.addAdditionalLogItem(item); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | ConfigurationDeleteListener<PasswordGeneratorCfg>, |
| | | ConfigurationChangeListener<PasswordGeneratorCfg> |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated password |
| | | * generators. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated password generators. */ |
| | | private final ConcurrentHashMap<DN,PasswordGenerator> passwordGenerators; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addPasswordGeneratorAddListener(this); |
| | | rootConfiguration.addPasswordGeneratorDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing password generators. |
| | | for (String generatorName : rootConfiguration.listPasswordGenerators()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordGeneratorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordGeneratorCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing generator if it's already enabled. |
| | | PasswordGenerator existingGenerator = |
| | | passwordGenerators.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the generator disabled, then disable it if |
| | | // it is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the password generator. If the generator is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | |
| | | return ccr; |
| | | } |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | PasswordGeneratorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PasswordGeneratorCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PasswordGeneratorCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PasswordGeneratorCfg configuration) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public abstract class PasswordPolicy extends AuthenticationPolicy |
| | | { |
| | | |
| | | /** Creates a new password policy. */ |
| | | protected PasswordPolicy() |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract DN getDN(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the associated password attribute uses the auth password |
| | | * syntax. |
| | |
| | | */ |
| | | public abstract boolean isAuthPasswordSyntax(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default set of password storage schemes that will be used for |
| | | * this password policy. The returned set should not be modified by the |
| | |
| | | public abstract List<PasswordStorageScheme<?>> |
| | | getDefaultPasswordStorageSchemes(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "deprecated-password-storage-scheme" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract Set<String> getDeprecatedPasswordStorageSchemes(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the specified storage scheme is a default scheme for this |
| | | * password policy. |
| | |
| | | */ |
| | | public abstract boolean isDefaultPasswordStorageScheme(String name); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the specified storage scheme is deprecated. |
| | | * |
| | |
| | | */ |
| | | public abstract boolean isDeprecatedPasswordStorageScheme(String name); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of password validators for this password policy. The |
| | | * returned list should not be altered by the caller. |
| | |
| | | */ |
| | | public abstract Collection<PasswordValidator<?>> getPasswordValidators(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of account status notification handlers that should be |
| | | * used with this password policy. The returned list should not be altered by |
| | |
| | | public abstract Collection<AccountStatusNotificationHandler<?>> |
| | | getAccountStatusNotificationHandlers(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the password generator that will be used with this password |
| | | * policy. |
| | |
| | | */ |
| | | public abstract PasswordGenerator<?> getPasswordGenerator(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the time by which all users will be required to change their |
| | | * passwords, expressed in the number of milliseconds since midnight of |
| | |
| | | */ |
| | | public abstract long getRequireChangeByTime(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "allow-expired-password-changes" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isAllowExpiredPasswordChanges(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "allow-multiple-password-values" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isAllowMultiplePasswordValues(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "allow-pre-encoded-passwords" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isAllowPreEncodedPasswords(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "allow-user-password-changes" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isAllowUserPasswordChanges(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "expire-passwords-without-warning" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isExpirePasswordsWithoutWarning(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "force-change-on-add" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isForceChangeOnAdd(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "force-change-on-reset" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isForceChangeOnReset(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "grace-login-count" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract int getGraceLoginCount(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "idle-lockout-interval" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getIdleLockoutInterval(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "last-login-time-attribute" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract AttributeType getLastLoginTimeAttribute(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "last-login-time-format" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract String getLastLoginTimeFormat(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "lockout-duration" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getLockoutDuration(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "lockout-failure-count" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract int getLockoutFailureCount(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "lockout-failure-expiration-interval" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getLockoutFailureExpirationInterval(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "max-password-age" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getMaxPasswordAge(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "max-password-reset-age" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getMaxPasswordResetAge(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "min-password-age" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getMinPasswordAge(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "password-attribute" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract AttributeType getPasswordAttribute(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "password-change-requires-current-password" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isPasswordChangeRequiresCurrentPassword(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "password-expiration-warning-interval" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getPasswordExpirationWarningInterval(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "password-history-count" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract int getPasswordHistoryCount(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "password-history-duration" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract long getPasswordHistoryDuration(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "previous-last-login-time-format" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract SortedSet<String> getPreviousLastLoginTimeFormats(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "require-secure-authentication" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isRequireSecureAuthentication(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "require-secure-password-changes" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isRequireSecurePasswordChanges(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "skip-validation-for-administrators" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract boolean isSkipValidationForAdministrators(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the "state-update-failure-policy" property. |
| | | * <p> |
| | |
| | | */ |
| | | public abstract StateUpdateFailurePolicy getStateUpdateFailurePolicy(); |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isPasswordPolicy() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordPolicyState createAuthenticationPolicyState(Entry userEntry, |
| | | long time) throws DirectoryException |
| | | { |
| | |
| | | ConfigurationAddListener <PasswordStorageSchemeCfg>, |
| | | ConfigurationDeleteListener <PasswordStorageSchemeCfg> |
| | | { |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated password |
| | | * storage schemes. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated password storage schemes. */ |
| | | private final ConcurrentHashMap<DN,PasswordStorageScheme> storageSchemes; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | storageSchemes = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all password storage schemes currently defined in the Directory |
| | | * Server configuration. This should only be called at Directory Server |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | |
| | | return status; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordStorageSchemeCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | |
| | | return status; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PasswordStorageSchemeCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PasswordStorageSchemeCfg configuration |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a password storage scheme, |
| | | * and optionally initializes that instance. Any initialized password |
| | |
| | | DirectoryServer.registerPasswordStorageScheme (configEntryDN, schemeClass); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a password storage scheme, |
| | | * and optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove a password storage that has been installed in the server. |
| | | * |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | implements ConfigurationChangeListener<PasswordValidatorCfg>, |
| | | ConfigurationAddListener<PasswordValidatorCfg>, |
| | | ConfigurationDeleteListener<PasswordValidatorCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated password |
| | | * validators. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated password validators. */ |
| | | private final ConcurrentHashMap<DN,PasswordValidator> passwordValidators; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addPasswordValidatorAddListener(this); |
| | | rootConfiguration.addPasswordValidatorDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing password validators. |
| | | for (String validatorName : rootConfiguration.listPasswordValidators()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | PasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PasswordValidatorCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PasswordValidatorCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PasswordValidatorCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing validator if it's already enabled. |
| | | PasswordValidator existingValidator = |
| | | passwordValidators.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the validator disabled, then disable it if |
| | | // it is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the password validator. If the validator is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a password validator, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public final class PersistentSearch |
| | | { |
| | | |
| | | /** |
| | | * A cancellation call-back which can be used by work-flow element |
| | | * implementations in order to register for resource cleanup when a |
| | |
| | | */ |
| | | public static interface CancellationCallback |
| | | { |
| | | |
| | | /** |
| | | * The provided persistent search has been cancelled. Any |
| | | * resources associated with the persistent search should be |
| | |
| | | } |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** Cancel a persistent search. */ |
| | | private static synchronized void cancel(PersistentSearch psearch) |
| | | { |
| | |
| | | /** Indicates whether or not this persistent search has already been aborted. */ |
| | | private boolean isCancelled; |
| | | |
| | | /** |
| | | * Indicates whether entries returned should include the entry change |
| | | * notification control. |
| | | */ |
| | | /** Indicates whether entries returned should include the entry change notification control. */ |
| | | private final boolean returnECs; |
| | | |
| | | /** The reference to the associated search operation. */ |
| | |
| | | this.returnECs = returnECs; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Cancels this persistent search operation. On exit this persistent |
| | | * search will no longer be valid and any resources associated with |
| | |
| | | return new CancelResult(ResultCode.CANCELLED, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the message ID associated with this persistent search. |
| | | * |
| | |
| | | return searchOperation.getMessageID(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the search operation associated with this persistent search. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Notifies the persistent searches that an entry has been modified. |
| | | * |
| | |
| | | processModify(entry, entry); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Notifies persistent searches that an entry has been modified. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Registers a cancellation callback with this persistent search. |
| | | * The cancellation callback will be notified when this persistent |
| | |
| | | cancellationCallbacks.add(callback); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Enable this persistent search. The persistent search will be |
| | | * registered with the client connection and will be prevented from |
| | |
| | | DirectoryServer.registerPersistentSearch(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a string representation of this persistent search. |
| | | * |
| | |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this persistent search to the |
| | | * provided buffer. |
| | |
| | | private DirectoryServerPlugin[] subordinateDeletePlugins; |
| | | private DirectoryServerPlugin[] intermediateResponsePlugins; |
| | | |
| | | |
| | | /** |
| | | * The mapping between the DN of a plugin entry and the plugin instance loaded |
| | | * from that entry. |
| | | */ |
| | | /** The mapping between the DN of a plugin entry and the plugin instance loaded from that entry. */ |
| | | private ConcurrentHashMap<DN, |
| | | DirectoryServerPlugin<? extends PluginCfg>> |
| | | registeredPlugins; |
| | |
| | | /** The plugin root configuration read at server startup. */ |
| | | private PluginRootCfg pluginRootConfig; |
| | | |
| | | /** |
| | | * The lock that will provide threadsafe access to the sets of registered |
| | | * plugins. |
| | | */ |
| | | /** The lock that will provide threadsafe access to the sets of registered plugins. */ |
| | | private ReentrantLock pluginLock; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | skippedPreOperationPlugins = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes this plugin configuration manager. This should only be called |
| | | * at Directory Server startup and before user plugins are loaded. |
| | |
| | | pluginRootConfig.addPluginDeleteListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes any plugins defined in the directory server |
| | | * configuration. This should only be called at Directory Server |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a plugin, and optionally |
| | | * initializes that plugin. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the OpenDS plugin type object that corresponds to the configuration |
| | | * counterpart. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Finalizes all plugins that are registered with the Directory Server. |
| | | */ |
| | | /** Finalizes all plugins that are registered with the Directory Server. */ |
| | | public void finalizePlugins() |
| | | { |
| | | pluginLock.lock(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of plugins that have been registered with the Directory |
| | | * Server. |
| | |
| | | return registeredPlugins; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the plugin with the specified configuration entry DN. |
| | | * |
| | |
| | | return registeredPlugins.get(pluginDN); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Registers the provided internal plugin with this plugin config |
| | | * manager and ensures that it will be invoked in the specified ways. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register a plugin in the appropriate tables. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Registers the provided plugin with this plugin config manager and |
| | | * ensures that it will be invoked in the specified ways. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Adds the provided plugin to the given array. The provided array will not |
| | | * itself be modified, but rather a new array will be created with one |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Parse the array of already registered plugins to sort them accordingly. |
| | | HashMap<String,DirectoryServerPlugin> initialPlugins = new HashMap<>(initialPluginNames.size()); |
| | | HashMap<String,DirectoryServerPlugin> finalPlugins = new HashMap<>(finalPluginNames.size()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Get the name of the provided plugin from its RDN value and put it in |
| | | // the correct category. |
| | | DN dn = plugin.getPluginEntryDN(); |
| | |
| | | otherPlugins.add(plugin); |
| | | } |
| | | |
| | | |
| | | // Compile a list of all the plugins in the correct order, convert it to |
| | | // an array, and return it. |
| | | ArrayList<DirectoryServerPlugin> newList = new ArrayList<>(pluginArray.length + 1); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters the provided internal plugin. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters the plugin with the provided configuration entry DN. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters the provided plugin. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes the provided plugin from the given array. The provided array will |
| | | * not itself be modified, but rather a new array will be created with one |
| | |
| | | return pluginArray; |
| | | } |
| | | |
| | | |
| | | // If it was the only element in the array, then return an empty array. |
| | | if (length == 0) |
| | | { |
| | | return new DirectoryServerPlugin[0]; |
| | | } |
| | | |
| | | |
| | | // Create an array that's one element smaller and copy the remaining "good" |
| | | // elements into it. |
| | | DirectoryServerPlugin[] newPlugins = new DirectoryServerPlugin[length-1]; |
| | |
| | | return newPlugins; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of startup plugins that have been registered with the |
| | | * Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of shutdown plugins that have been configured in the |
| | | * Directory Server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-connect plugins that have been configured in the |
| | | * Directory Server. |
| | |
| | | DisconnectReason.SERVER_ERROR, true, message); |
| | | } |
| | | |
| | | |
| | | if (result == null) |
| | | { |
| | | LocalizableMessage message = ERR_PLUGIN_POST_CONNECT_PLUGIN_RETURNED_NULL. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-disconnect plugins that have been configured in the |
| | | * Directory Server. |
| | |
| | | stackTraceToSingleLineString(e)); |
| | | } |
| | | |
| | | |
| | | if (result == null) |
| | | { |
| | | logger.error(ERR_PLUGIN_POST_DISCONNECT_PLUGIN_RETURNED_NULL, |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of LDIF import plugins that have been configured in the |
| | | * Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the LDIF import session finalization of LDIF import plugins that |
| | | * have been configured in the Directory Server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the LDIF import session initialization of LDIF import plugins that |
| | | * have been configured in the Directory Server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of LDIF export plugins that have been configured in the |
| | | * Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse abandon plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private PluginResult.PreParse handlePreParseException( |
| | | Exception e, PreParseOperation operation, DirectoryServerPlugin plugin) |
| | | { |
| | |
| | | .getServerErrorResultCode(), message); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse add plugins that have been configured in the |
| | | * Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse bind plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse compare plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse delete plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse extended plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse modify plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse modify DN plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse search plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-parse unbind plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation add plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation bind plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation compare plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation delete plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | .getServerErrorResultCode(), message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation extended plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation modify plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation modify DN plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of pre-operation search plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation abandon plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation add plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation bind plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation compare plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation extended plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation modify plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation modify DN plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation search plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-operation unbind plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return finalResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response add plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response bind plugins that have been configured in |
| | | * the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response compare plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response extended plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response modify plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response modify DN plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-response search plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-synchronization delete plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of post-synchronization modify DN plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of search result entry plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of search result reference plugins that have been |
| | | * configured in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of subordinate modify DN plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of subordinate delete plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the set of intermediate response plugins that have been configured |
| | | * in the Directory Server. |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable(PluginCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | PluginCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | PluginCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | PluginCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PluginCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PluginCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing plugin if it's already enabled. |
| | | DirectoryServerPlugin existingPlugin = |
| | | registeredPlugins.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the plugin disabled, then deregister it if |
| | | // it is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the identity mapper. If the mapper is already enabled, |
| | | // then we shouldn't do anything with it although if the class has changed |
| | | // then we'll at least need to indicate that administrative action is |
| | |
| | | implements ConfigurationChangeListener<RootDNUserCfg>, |
| | | ConfigurationAddListener<RootDNUserCfg>, |
| | | ConfigurationDeleteListener<RootDNUserCfg> |
| | | |
| | | { |
| | | /** A mapping between the actual root DNs and their alternate bind DNs. */ |
| | | private ConcurrentHashMap<DN,HashSet<DN>> alternateBindDNs; |
| | |
| | | rootPrivilegeChangeListener.setDefaultRootPrivileges(rootDNCfg); |
| | | rootDNCfg.addChangeListener(rootPrivilegeChangeListener); |
| | | |
| | | |
| | | rootDNCfg.addRootDNUserAddListener(this); |
| | | rootDNCfg.addRootDNUserDeleteListener(this); |
| | | |
| | | |
| | | // Get the set of root users defined below "cn=Root DNs,cn=config". For |
| | | // each one, register as a change listener, and get the set of alternate |
| | | // bind DNs. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of privileges that will be granted to root users by |
| | | * default. |
| | |
| | | return rootPrivilegeChangeListener.getDefaultRootPrivileges(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable(RootDNUserCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd(RootDNUserCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable(RootDNUserCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | RootDNUserCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(RootDNUserCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RootDNUserCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | defaultRootPrivileges = Privilege.getDefaultRootPrivileges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(RootDNCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(RootDNCfg configuration) |
| | | { |
| | |
| | | return defaultRootPrivileges; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the set of privileges that will be automatically granted to root |
| | | * users. |
| | |
| | | ConfigurationAddListener<SASLMechanismHandlerCfg>, |
| | | ConfigurationDeleteListener<SASLMechanismHandlerCfg> |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated SASL |
| | | * mechanism handlers. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated SASL mechanism handlers. */ |
| | | private final ConcurrentHashMap<DN, SASLMechanismHandler> handlers; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | handlers = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all SASL mechanism handlers currently defined in the Directory |
| | | * Server configuration. This should only be called at Directory Server |
| | |
| | | rootConfiguration.addSASLMechanismHandlerAddListener(this); |
| | | rootConfiguration.addSASLMechanismHandlerDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing SASL mechanism handlers. |
| | | for (String handlerName : rootConfiguration.listSASLMechanismHandlers()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | SASLMechanismHandlerCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | SASLMechanismHandlerCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SASLMechanismHandlerCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing handler if it's already enabled. |
| | | SASLMechanismHandler existingHandler = handlers.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the handler disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the SASL handler. If the handler is already enabled, |
| | | // then we shouldn't do anything with it although if the class has changed |
| | | // then we'll at least need to indicate that administrative action is |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a SASL mechanism hanlder, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the path to the directory containing the server schema files. |
| | | * |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a reference to the schema information that has been read from the |
| | | * server configuration. Note that this information will not be complete |
| | |
| | | return schema; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all the matching rules defined in the Directory Server |
| | | * configuration. This should only be called at Directory Server startup. |
| | |
| | | matchingRuleConfigManager.initializeMatchingRules(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all the attribute syntaxes defined in the Directory Server |
| | | * configuration. This should only be called at Directory Server startup. |
| | |
| | | syntaxConfigManager.initializeAttributeSyntaxes(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Filter implementation that accepts only ldif files. |
| | | */ |
| | | /** Filter implementation that accepts only ldif files. */ |
| | | public static class SchemaFileFilter implements FilenameFilter |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean accept(File directory, String filename) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes all the attribute type, object class, name form, DIT content |
| | | * rule, DIT structure rule, and matching rule use definitions by reading the |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | |
| | | FilenameFilter filter = new SchemaFileFilter(); |
| | | File[] schemaInstanceDirFiles = |
| | | schemaInstanceDir.listFiles(filter); |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | // If the oldest and youngest modification timestamps didn't get set for |
| | | // some reason, then set them to the current time. |
| | | if (oldestModificationTime <= 0) |
| | |
| | | schema.setOldestModificationTime(oldestModificationTime); |
| | | schema.setYoungestModificationTime(youngestModificationTime); |
| | | |
| | | |
| | | // Iterate through the schema files and read them as an LDIF file containing |
| | | // a single entry. Then get the attributeTypes and objectClasses attributes |
| | | // from that entry and parse them to initialize the server schema. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the contents of the specified schema file into the provided schema. |
| | | * |
| | |
| | | return loadSchemaFile(schema, schemaFile, true); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the contents of the specified schema file into the provided schema. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Read the LDIF entry from the file and close the file. |
| | | Entry entry; |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * This method checks if a given attribute is an attribute that |
| | | * is used by the definition of the schema. |
| | |
| | | attributeOid.equals("ldapsyntaxes-oid"); |
| | | } |
| | | } |
| | | |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | DN getProxiedAuthorizationDN(); |
| | | |
| | | /** |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | void setProxiedAuthorizationDN(DN proxiedAuthorizationDN); |
| | | |
| | | } |
| | |
| | | public abstract class SearchOperationWrapper extends |
| | | OperationWrapper<SearchOperation> implements SearchOperation |
| | | { |
| | | |
| | | /** |
| | | * Creates a new search operation based on the provided search operation. |
| | | * |
| | |
| | | super(search); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean returnEntry(Entry entry, List<Control> controls) |
| | | { |
| | | return getOperation().returnEntry(entry, controls); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean returnEntry(Entry entry, List<Control> controls, |
| | | boolean evaluateAci) |
| | |
| | | return getOperation().returnEntry(entry, controls, evaluateAci); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean returnReference(DN dn, SearchResultReference reference) |
| | | { |
| | | return getOperation().returnReference(dn, reference); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean returnReference(DN dn, SearchResultReference reference, |
| | | boolean evaluateAci) |
| | |
| | | return getOperation().returnReference(dn, reference, evaluateAci); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return getOperation().toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getAttributes() |
| | | { |
| | | return getOperation().getAttributes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getBaseDN() |
| | | { |
| | | return getOperation().getBaseDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DereferenceAliasesPolicy getDerefPolicy() |
| | | { |
| | | return getOperation().getDerefPolicy(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getEntriesSent() |
| | | { |
| | | return getOperation().getEntriesSent(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SearchFilter getFilter() |
| | | { |
| | | return getOperation().getFilter(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getRawBaseDN() |
| | | { |
| | | return getOperation().getRawBaseDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public RawFilter getRawFilter() |
| | | { |
| | | return getOperation().getRawFilter(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getReferencesSent() |
| | | { |
| | | return getOperation().getReferencesSent(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SearchScope getScope() |
| | | { |
| | | return getOperation().getScope(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getSizeLimit() |
| | | { |
| | | return getOperation().getSizeLimit(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getTimeLimit() |
| | | { |
| | | return getOperation().getTimeLimit(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean getTypesOnly() |
| | | { |
| | | return getOperation().getTypesOnly(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void sendSearchResultDone() |
| | | { |
| | | getOperation().sendSearchResultDone(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAttributes(Set<String> attributes) |
| | | { |
| | | getOperation().setAttributes(attributes); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setBaseDN(DN baseDN) |
| | | { |
| | | getOperation().setBaseDN(baseDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDerefPolicy(DereferenceAliasesPolicy derefPolicy) |
| | | { |
| | | getOperation().setDerefPolicy(derefPolicy); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawBaseDN(ByteString rawBaseDN) |
| | | { |
| | | getOperation().setRawBaseDN(rawBaseDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRawFilter(RawFilter rawFilter) |
| | | { |
| | | getOperation().setRawFilter(rawFilter); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setScope(SearchScope scope) |
| | | { |
| | | getOperation().setScope(scope); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setSizeLimit(int sizeLimit) |
| | | { |
| | | getOperation().setSizeLimit(sizeLimit); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTimeLimit(int timeLimit) |
| | | { |
| | | getOperation().setTimeLimit(timeLimit); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTypesOnly(boolean typesOnly) |
| | | { |
| | | getOperation().setTypesOnly(typesOnly); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTimeLimitExpiration(long timeLimitExpiration) |
| | | { |
| | | getOperation().setTimeLimitExpiration(timeLimitExpiration); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReturnSubentriesOnly() |
| | | { |
| | | return getOperation().isReturnSubentriesOnly(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setReturnSubentriesOnly(boolean returnLDAPSubentries) |
| | | { |
| | | getOperation().setReturnSubentriesOnly(returnLDAPSubentries); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MatchedValuesControl getMatchedValuesControl() |
| | | { |
| | | return getOperation().getMatchedValuesControl(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setMatchedValuesControl(MatchedValuesControl controls) |
| | | { |
| | | getOperation().setMatchedValuesControl(controls); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isIncludeUsableControl() |
| | | { |
| | | return getOperation().isIncludeUsableControl(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setIncludeUsableControl(boolean includeUsableControl) |
| | | { |
| | | getOperation().setIncludeUsableControl(includeUsableControl); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getTimeLimitExpiration() |
| | | { |
| | | return getOperation().getTimeLimitExpiration(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isClientAcceptsReferrals() |
| | | { |
| | | return getOperation().isClientAcceptsReferrals(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setClientAcceptsReferrals(boolean clientAcceptReferrals) |
| | | { |
| | | getOperation().setClientAcceptsReferrals(clientAcceptReferrals); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSendResponse() |
| | | { |
| | | return getOperation().isSendResponse(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setSendResponse(boolean sendResponse) |
| | | { |
| | | getOperation().setSendResponse(sendResponse); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRealAttributesOnly(){ |
| | | return getOperation().isRealAttributesOnly(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRealAttributesOnly(boolean realAttributesOnly){ |
| | | getOperation().setRealAttributesOnly(realAttributesOnly); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isVirtualAttributesOnly() |
| | | { |
| | | return getOperation().isVirtualAttributesOnly(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVirtualAttributesOnly(boolean virtualAttributesOnly){ |
| | | getOperation().setVirtualAttributesOnly(virtualAttributesOnly); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void sendSearchEntry(SearchResultEntry entry) |
| | | throws DirectoryException |
| | |
| | | getOperation().sendSearchEntry(entry); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean sendSearchReference(SearchResultReference reference) |
| | | throws DirectoryException |
| | | { |
| | | return getOperation().sendSearchReference(reference); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | // Password Policy Subentry draft attributes. |
| | | /** Password Policy Subentry draft attributes. */ |
| | | private static final String PWD_OC_POLICY = "pwdpolicy"; |
| | | private static final String PWD_ATTR_ATTRIBUTE = "pwdattribute"; |
| | | private static final String PWD_ATTR_MINAGE = "pwdminage"; |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Helper method to validate integer values. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Helper method to retrieve an attribute value from given entry. |
| | | * |
| | |
| | | : getDefaultPasswordPolicy().isAllowUserPasswordChanges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isExpirePasswordsWithoutWarning() |
| | | { |
| | | return getDefaultPasswordPolicy().isExpirePasswordsWithoutWarning(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isForceChangeOnAdd() |
| | | { |
| | |
| | | return getDefaultPasswordPolicy().isForceChangeOnAdd(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isForceChangeOnReset() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().isForceChangeOnReset(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getGraceLoginCount() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getGraceLoginCount(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getIdleLockoutInterval() |
| | | { |
| | | return getDefaultPasswordPolicy().getIdleLockoutInterval(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AttributeType getLastLoginTimeAttribute() |
| | | { |
| | | return getDefaultPasswordPolicy().getLastLoginTimeAttribute(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getLastLoginTimeFormat() |
| | | { |
| | | return getDefaultPasswordPolicy().getLastLoginTimeFormat(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getLockoutDuration() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getLockoutDuration(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getLockoutFailureCount() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getLockoutFailureCount(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getLockoutFailureExpirationInterval() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getLockoutFailureExpirationInterval(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getMaxPasswordAge() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getMaxPasswordAge(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getMaxPasswordResetAge() |
| | | { |
| | | return getDefaultPasswordPolicy().getMaxPasswordResetAge(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getMinPasswordAge() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getMinPasswordAge(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AttributeType getPasswordAttribute() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getPasswordAttribute(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isPasswordChangeRequiresCurrentPassword() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().isPasswordChangeRequiresCurrentPassword(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getPasswordExpirationWarningInterval() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getPasswordExpirationWarningInterval(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getPasswordHistoryCount() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().getPasswordHistoryCount(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getPasswordHistoryDuration() |
| | | { |
| | | return getDefaultPasswordPolicy().getPasswordHistoryDuration(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SortedSet<String> getPreviousLastLoginTimeFormats() |
| | | { |
| | | return getDefaultPasswordPolicy().getPreviousLastLoginTimeFormats(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getRequireChangeByTime() |
| | | { |
| | | return getDefaultPasswordPolicy().getRequireChangeByTime(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRequireSecureAuthentication() |
| | | { |
| | | return getDefaultPasswordPolicy().isRequireSecureAuthentication(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRequireSecurePasswordChanges() |
| | | { |
| | | return getDefaultPasswordPolicy().isRequireSecurePasswordChanges(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSkipValidationForAdministrators() |
| | | { |
| | | return getDefaultPasswordPolicy().isSkipValidationForAdministrators(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public StateUpdateFailurePolicy getStateUpdateFailurePolicy() |
| | | { |
| | | return getDefaultPasswordPolicy().getStateUpdateFailurePolicy(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAuthPasswordSyntax() |
| | | { |
| | |
| | | : getDefaultPasswordPolicy().isAuthPasswordSyntax(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<PasswordStorageScheme<?>> getDefaultPasswordStorageSchemes() |
| | | { |
| | | return getDefaultPasswordPolicy().getDefaultPasswordStorageSchemes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getDeprecatedPasswordStorageSchemes() |
| | | { |
| | | return getDefaultPasswordPolicy().getDeprecatedPasswordStorageSchemes(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getDN() |
| | | { |
| | | return passwordPolicySubentryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDefaultPasswordStorageScheme(String name) |
| | | { |
| | | return getDefaultPasswordPolicy().isDefaultPasswordStorageScheme(name); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDeprecatedPasswordStorageScheme(String name) |
| | | { |
| | | return getDefaultPasswordPolicy().isDeprecatedPasswordStorageScheme(name); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Collection<PasswordValidator<?>> getPasswordValidators() |
| | | { |
| | |
| | | return getDefaultPasswordPolicy().getPasswordValidators(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Implementation of a specific Password Validator that reject all |
| | | * password due to mis-configured password policy subentry. |
| | |
| | | pwPolicyName = policyName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator(PasswordValidatorCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | // do nothing |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Collection<AccountStatusNotificationHandler<?>> |
| | | getAccountStatusNotificationHandlers() |
| | |
| | | return getDefaultPasswordPolicy().getAccountStatusNotificationHandlers(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordGenerator<?> getPasswordGenerator() |
| | | { |
| | | return getDefaultPasswordPolicy().getPasswordGenerator(); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SynchronizationProviderCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SynchronizationProviderCfg configuration, |
| | |
| | | || isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | SynchronizationProviderCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | SynchronizationProviderCfg configuration, |
| | |
| | | || isJavaClassAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Check if the class provided in the configuration is an acceptable |
| | | * java class for a synchronization provider. |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | SynchronizationProviderCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | SynchronizationProviderCfg configuration, |
| | |
| | | implements ConfigurationChangeListener<TrustManagerProviderCfg>, |
| | | ConfigurationAddListener<TrustManagerProviderCfg>, |
| | | ConfigurationDeleteListener<TrustManagerProviderCfg> |
| | | |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated trust |
| | | * manager providers. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated trust manager providers. */ |
| | | private final ConcurrentHashMap<DN,TrustManagerProvider> providers; |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addTrustManagerProviderAddListener(this); |
| | | rootConfiguration.addTrustManagerProviderDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing trust manager providers. |
| | | for (String name : rootConfiguration.listTrustManagerProviders()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | TrustManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | TrustManagerProviderCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | TrustManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | TrustManagerProviderCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | TrustManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TrustManagerProviderCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing provider if it's already enabled. |
| | | TrustManagerProvider existingProvider = providers.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the provider disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Get the class for the trust manager provider. If the provider is already |
| | | // enabled, then we shouldn't do anything with it although if the class has |
| | | // changed then we'll at least need to indicate that administrative action |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a trust manager provider, and |
| | | * optionally initializes that instance. |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | ERR_CANNOT_CANCEL_UNBIND.get()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | |
| | | return OperationType.UNBIND; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<Control> getResponseControls() |
| | | { |
| | |
| | | return NO_RESPONSE_CONTROLS; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | // An unbind operation can never have a response, so just ignore this. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | |
| | | |
| | | logUnbind(this); |
| | | |
| | | |
| | | // Check the set of controls included in the request. If there are any, |
| | | // see if any special processing is needed. |
| | | // NYI |
| | | |
| | | |
| | | // Disconnect the client. |
| | | getClientConnection().disconnect(DisconnectReason.UNBIND, false, null); |
| | | |
| | | |
| | | // Invoke the post-operation unbind plugins. |
| | | getPluginConfigManager().invokePostOperationUnbindPlugins(this); |
| | | |
| | | setProcessingStopTime(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | |
| | | buffer.append(operationID); |
| | | buffer.append(")"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * A mapping between the DNs of the config entries and the associated virtual |
| | | * attribute rules. |
| | | */ |
| | | /** A mapping between the DNs of the config entries and the associated virtual attribute rules. */ |
| | | private final ConcurrentMap<DN, VirtualAttributeRule> rules = new ConcurrentHashMap<>(); |
| | | |
| | | private final ServerContext serverContext; |
| | |
| | | rootConfiguration.addVirtualAttributeAddListener(this); |
| | | rootConfiguration.addVirtualAttributeDeleteListener(this); |
| | | |
| | | |
| | | //Initialize the existing virtual attribute providers. |
| | | for (String providerName : rootConfiguration.listVirtualAttributes()) |
| | | { |
| | |
| | | cfg.getConflictBehavior()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | VirtualAttributeCfg configuration, |
| | |
| | | return filters; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | VirtualAttributeCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | VirtualAttributeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | VirtualAttributeCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | VirtualAttributeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | VirtualAttributeCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the existing rule if it's already enabled. |
| | | VirtualAttributeRule existingRule = rules.get(configuration.dn()); |
| | | |
| | | |
| | | // If the new configuration has the rule disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | | if (! configuration.isEnabled()) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | // Make sure that we can parse all of the search filters. |
| | | Map<LocalizableMessage, DirectoryException> reasons = |
| | | new LinkedHashMap<>(); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the specified class, instantiates it as a certificate mapper, and |
| | | * optionally initializes that instance. |
| | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the Directory Server |
| | | * work queue. |
| | | */ |
| | | /** This class defines a utility that will be used to manage the Directory Server work queue. */ |
| | | public class WorkQueueConfigManager |
| | | implements ConfigurationChangeListener<WorkQueueCfg> |
| | | { |
| | |
| | | this.serverContext = serverContext; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes the Directory Server's work queue. This should only be called |
| | | * at server startup. |
| | |
| | | WorkQueueCfg workQueueConfig = serverContext.getRootConfig().getWorkQueue(); |
| | | workQueueConfig.addChangeListener(this); |
| | | |
| | | |
| | | // Get the work queue class, and load and instantiate an instance of it |
| | | // using that configuration. |
| | | WorkQueueCfgDefn definition = WorkQueueCfgDefn.getInstance(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(WorkQueueCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(WorkQueueCfg configuration) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.AESPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme that will |
| | | * encode values using the AES reversible encryption algorithm. This |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * The reference to the Directory Server crypto manager that we will use to |
| | | * handle the encryption/decryption. |
| | | */ |
| | | private CryptoManager cryptoManager; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | AESPasswordStorageSchemeCfg configuration) |
| | |
| | | cryptoManager = DirectoryServer.getCryptoManager(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_AES; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | /** The current configuration for this password validator. */ |
| | | private AttributeValuePasswordValidatorCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this attribute value password validator. |
| | | */ |
| | | /** Creates a new instance of this attribute value password validator. */ |
| | | public AttributeValuePasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | AttributeValuePasswordValidatorCfg configuration) |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeAttributeValueChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Search for substrings of the password in an Attribute. The search is |
| | | * case-insensitive. |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | // Get a handle to the current configuration. |
| | | AttributeValuePasswordValidatorCfg config = currentConfig; |
| | | |
| | | |
| | | // Get the string representation (both forward and reversed) for the password. |
| | | final String password = newPassword.toString(); |
| | | final String reversed = new StringBuilder(password).reverse().toString(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then the password is acceptable. |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | AttributeValuePasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | AttributeValuePasswordValidatorCfg configuration) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.Base64PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme that will store |
| | | * the values in base64-encoded form. This is a reversible algorithm that |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | Base64PasswordStorageSchemeCfg configuration) |
| | |
| | | // No initialization is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_BASE64; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(plaintext)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return userString.equals(storedString); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.cert.X509Certificate; |
| | | import javax.net.ssl.TrustManager; |
| | | import javax.net.ssl.X509TrustManager; |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a trust manager provider that will |
| | | * indicate that any certificate presented should be blindly trusted by the |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeTrustManagerProvider( |
| | | BlindTrustManagerProviderCfg configuration) |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any finalization that may be necessary for this trust manager |
| | | * provider. |
| | | */ |
| | | @Override |
| | | public void finalizeTrustManagerProvider() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public TrustManager[] getTrustManagers() |
| | | throws DirectoryException |
| | |
| | | return new TrustManager[] { this }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determines whether an SSL client with the provided certificate chain should |
| | | * be trusted. In this case, all client certificates will be trusted. |
| | |
| | | * @param chain The certificate chain for the SSL client. |
| | | * @param authType The authentication type based on the client certificate. |
| | | */ |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | // As long as we don't throw an exception, then the client certificate will |
| | | // be considered trusted. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determines whether an SSL server with the provided certificate chain should |
| | | * be trusted. In this case, all server certificates will be trusted. |
| | |
| | | * @param chain The certificate chain for the SSL server. |
| | | * @param authType The key exchange algorithm used. |
| | | */ |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | // As long as we don't throw an exception, then the server certificate will |
| | | // be considered trusted. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of certificate authority certificates which are trusted |
| | | * for authenticating peers. |
| | |
| | | * @return An empty array, since we don't care what certificates are |
| | | * presented because we will trust them all. |
| | | */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[0]; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.BlowfishPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme that will |
| | | * encode values using the Blowfish reversible encryption algorithm. This |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * The reference to the Directory Server crypto manager that we will use to |
| | | * handle the encryption/decryption. |
| | | */ |
| | | private CryptoManager cryptoManager; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | BlowfishPasswordStorageSchemeCfg configuration) |
| | |
| | | cryptoManager = DirectoryServer.getCryptoManager(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_BLOWFISH; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | /** The message digest engine that will be used to create the MD5 digests. */ |
| | | private MessageDigest md5Digest; |
| | | |
| | | /** |
| | | * The lock that will be used to provide threadsafe access to the message |
| | | * digest. |
| | | */ |
| | | /** The lock that will be used to provide threadsafe access to the message digest. */ |
| | | private Object digestLock; |
| | | |
| | | /** |
| | | * The random number generator that we will use to create the server challenge. |
| | | */ |
| | | /** The random number generator that we will use to create the server challenge. */ |
| | | private SecureRandom randomGenerator; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this SASL mechanism handler. No initialization |
| | | * should be done in this method, as it should all be performed in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSASLMechanismHandler( |
| | | CramMD5SASLMechanismHandlerCfg configuration) |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | // Create and fill the iPad and oPad arrays. |
| | | iPad = new byte[HMAC_MD5_BLOCK_LENGTH]; |
| | | oPad = new byte[HMAC_MD5_BLOCK_LENGTH]; |
| | | Arrays.fill(iPad, CRAMMD5_IPAD_BYTE); |
| | | Arrays.fill(oPad, CRAMMD5_OPAD_BYTE); |
| | | |
| | | |
| | | // Get the identity mapper that should be used to find users. |
| | | DN identityMapperDN = configuration.getIdentityMapperDN(); |
| | | identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN); |
| | |
| | | DirectoryServer.registerSASLMechanismHandler(SASL_MECHANISM_CRAM_MD5, this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeSASLMechanismHandler() |
| | | { |
| | |
| | | DirectoryServer.deregisterSASLMechanismHandler(SASL_MECHANISM_CRAM_MD5); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSASLBind(BindOperation bindOperation) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then the client did provide credentials. First, |
| | | // make sure that we have a stored version of the credentials associated |
| | | // with the client connection. If not, then it likely means that the client |
| | |
| | | // Wipe out the stored challenge so it can't be used again. |
| | | clientConnection.setSASLAuthStateInfo(null); |
| | | |
| | | |
| | | // Now look at the client credentials and make sure that we can decode them. |
| | | // It should be a username followed by a space and a digest string. Since |
| | | // the username itself may contain spaces but the digest string may not, |
| | |
| | | String userName = credString.substring(0, spacePos); |
| | | String digest = credString.substring(spacePos+1); |
| | | |
| | | |
| | | // Look at the digest portion of the provided credentials. It must have a |
| | | // length of exactly 32 bytes and be comprised only of hex characters. |
| | | if (digest.length() != 2*MD5_DIGEST_LENGTH) |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Get the user entry for the authentication ID. Allow for an |
| | | // authentication ID that is just a username (as per the CRAM-MD5 spec), but |
| | | // also allow a value in the authzid form specified in RFC 2829. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // At this point, we should have a user entry. If we don't then fail. |
| | | if (userEntry == null) |
| | | { |
| | |
| | | bindOperation.setSASLAuthUserEntry(userEntry); |
| | | } |
| | | |
| | | |
| | | // Get the clear-text passwords from the user entry, if there are any. |
| | | List<ByteString> clearPasswords; |
| | | try |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Iterate through the clear-text values and see if any of them can be used |
| | | // in conjunction with the challenge to construct the provided digest. |
| | | boolean matchFound = false; |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then the authentication was successful. |
| | | bindOperation.setResultCode(ResultCode.SUCCESS); |
| | | |
| | |
| | | bindOperation.setAuthenticationInfo(authInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates the appropriate HMAC-MD5 digest for a CRAM-MD5 authentication |
| | | * with the given information. |
| | |
| | | byte[] p = password.toByteArray(); |
| | | byte[] c = challenge.toByteArray(); |
| | | |
| | | |
| | | // Grab a lock to protect the MD5 digest generation. |
| | | synchronized (digestLock) |
| | | { |
| | |
| | | p = md5Digest.digest(p); |
| | | } |
| | | |
| | | |
| | | // Create byte arrays with data needed for the hash generation. |
| | | byte[] iPadAndData = new byte[HMAC_MD5_BLOCK_LENGTH + c.length]; |
| | | System.arraycopy(iPad, 0, iPadAndData, 0, HMAC_MD5_BLOCK_LENGTH); |
| | |
| | | byte[] oPadAndHash = new byte[HMAC_MD5_BLOCK_LENGTH + MD5_DIGEST_LENGTH]; |
| | | System.arraycopy(oPad, 0, oPadAndHash, 0, HMAC_MD5_BLOCK_LENGTH); |
| | | |
| | | |
| | | // Iterate through the bytes in the key and XOR them with the iPad and |
| | | // oPad as appropriate. |
| | | for (int i=0; i < p.length; i++) |
| | |
| | | oPadAndHash[i] ^= p[i]; |
| | | } |
| | | |
| | | |
| | | // Copy an MD5 digest of the iPad-XORed key and the data into the array to |
| | | // be hashed. |
| | | System.arraycopy(md5Digest.digest(iPadAndData), 0, oPadAndHash, |
| | | HMAC_MD5_BLOCK_LENGTH, MD5_DIGEST_LENGTH); |
| | | |
| | | |
| | | // Return an MD5 digest of the resulting array. |
| | | return md5Digest.digest(oPadAndHash); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isPasswordBased(String mechanism) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSecure(String mechanism) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CramMD5SASLMechanismHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CramMD5SASLMechanismHandlerCfg configuration) |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeExtendedOperationHandler( |
| | | CancelExtendedOperationHandlerCfg config) |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Create the cancel request for the target operation. |
| | | LocalizableMessage cancelReason = |
| | | INFO_EXTOP_CANCEL_REASON.get(operation.getMessageID()); |
| | | CancelRequest cancelRequest = new CancelRequest(true, cancelReason); |
| | | |
| | | |
| | | // Get the client connection and attempt the cancel. |
| | | ClientConnection clientConnection = operation.getClientConnection(); |
| | | CancelResult cancelResult = clientConnection.cancelOperation(idToCancel, |
| | | cancelRequest); |
| | | |
| | | |
| | | // Update the result of the extended operation and return. |
| | | ResultCode resultCode = cancelResult.getResultCode(); |
| | | operation.setResultCode(resultCode == ResultCode.CANCELLED |
| | |
| | | operation.appendErrorMessage(cancelResult.getResponseMessage()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationOID() |
| | | { |
| | | return OID_CANCEL_REQUEST; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationName() |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | * |
| | | * @return The human-readable name for this certificate validation policy. |
| | | */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return policyName; |
| | |
| | | /** The current configuration for this password validator. */ |
| | | private CharacterSetPasswordValidatorCfg currentConfig; |
| | | |
| | | /** |
| | | * A mapping between the character sets and the minimum number of characters |
| | | * required for each. |
| | | */ |
| | | /** A mapping between the character sets and the minimum number of characters required for each. */ |
| | | private HashMap<String,Integer> characterSets; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private HashMap<String,Integer> characterRanges; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this character set password validator. |
| | | */ |
| | | /** Creates a new instance of this character set password validator. */ |
| | | public CharacterSetPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | CharacterSetPasswordValidatorCfg configuration) |
| | |
| | | processCharacterSetsAndRanges(configuration, true); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeCharacterSetChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | CharacterSetPasswordValidatorCfg config = currentConfig; |
| | | HashMap<String,Integer> characterSets = this.characterSets; |
| | | |
| | | |
| | | // Process the provided password. |
| | | String password = newPassword.toString(); |
| | | HashMap<String,Integer> setCounts = new HashMap<>(); |
| | |
| | | usedOptionalCharacterSets++; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // Check minimum optional character sets are present. |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Parses the provided configuration and extracts the character set |
| | | * definitions and associated minimum counts from them. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CharacterSetPasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CharacterSetPasswordValidatorCfg configuration) |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.ClearPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme that will store |
| | | * the values in clear-text with no encoding at all. This is not at all secure |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | ClearPasswordStorageSchemeCfg configuration) |
| | |
| | | // No initialization is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_CLEAR; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return plaintext.toByteString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return plaintextPassword.equals(storedPassword); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | return storedPassword.toByteString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | extends VirtualAttributeProvider< |
| | | CollectiveAttributeSubentriesVirtualAttributeCfg> |
| | | { |
| | | /** |
| | | * Creates a new instance of this collectiveAttributeSubentries |
| | | * virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this collectiveAttributeSubentries virtual attribute provider. */ |
| | | public CollectiveAttributeSubentriesVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(rule.getAttributeType()); |
| | | if (!entry.isSubentry() && !entry.isLDAPSubentry()) |
| | | { |
| | |
| | | return builder.toAttribute(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | extends PasswordStorageScheme<CryptPasswordStorageSchemeCfg> |
| | | implements ConfigurationChangeListener<CryptPasswordStorageSchemeCfg> |
| | | { |
| | | |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | /** The fully-qualified name of this class for debugging purposes. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.CryptPasswordStorageScheme"; |
| | | |
| | | /** |
| | | * The current configuration for the CryptPasswordStorageScheme. |
| | | */ |
| | | /** The current configuration for the CryptPasswordStorageScheme. */ |
| | | private CryptPasswordStorageSchemeCfg currentConfig; |
| | | |
| | | /** |
| | |
| | | private final Object saltLock = new Object(); |
| | | private final Crypt crypt = new Crypt(); |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | CryptPasswordStorageSchemeCfg configuration) |
| | | throws ConfigException, InitializationException { |
| | | |
| | | configuration.addCryptChangeListener(this); |
| | | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_CRYPT; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Encrypt plaintext password with the Unix Crypt algorithm. |
| | | */ |
| | | /** Encrypt plaintext password with the Unix Crypt algorithm. */ |
| | | private ByteString unixCryptEncodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | | { |
| | |
| | | return ByteString.valueOfUtf8(output); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return bytes; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | /** |
| | | * Matches passwords encrypted with the Unix Crypt algorithm. |
| | | */ |
| | | /** Matches passwords encrypted with the Unix Crypt algorithm. */ |
| | | private boolean unixCryptPasswordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | // category, but it's certainly a lot more vulnerable to lookup tables |
| | | // than most other algorithms. I'd say we can keep it this way for now, |
| | | // but it might be something to reconsider later. |
| | | // |
| | | // Currently, this method is unused. However, the intended purpose is |
| | | // eventually for use in issue #321, where we could do things like prevent |
| | | // even authorized users from seeing the password value over an insecure |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CryptPasswordStorageSchemeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CryptPasswordStorageSchemeCfg configuration) |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** |
| | | * The entry cache order array reflects all currently configured and |
| | | * active entry cache implementations in cache level specific order. |
| | |
| | | private static EntryCache<? extends EntryCacheCfg>[] cacheOrder = |
| | | new EntryCache<?>[0]; |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this default entry cache. |
| | | */ |
| | | /** Creates a new instance of this default entry cache. */ |
| | | public DefaultEntryCache() |
| | | { |
| | | super(); |
| | |
| | | DirectoryServer.registerBackendInitializationListener(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeEntryCache(EntryCacheCfg configEntry) |
| | | throws ConfigException, InitializationException |
| | |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeEntryCache() |
| | | { |
| | |
| | | cacheOrder = new EntryCache<?>[0]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsEntry(DN entryDN) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(String backendID, long entryID) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(DN entryDN) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getEntryID(DN entryDN) |
| | | { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN(String backendID, long entryID) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void putEntry(Entry entry, String backendID, long entryID) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean putEntryIfAbsent(Entry entry, String backendID, long entryID) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeEntry(DN entryDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clear() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearBackend(String backendID) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearSubtree(DN baseDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleLowMemory() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | EntryCacheCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(EntryCacheCfg configuration) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Long getCacheCount() |
| | | { |
| | |
| | | return cacheCount; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toVerboseString() |
| | | { |
| | |
| | | return verboseString.length() > 0 ? verboseString : null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the current cache order array. |
| | | * |
| | |
| | | return DefaultEntryCache.cacheOrder; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the current cache order array. |
| | | * |
| | |
| | | cacheOrderMap.values().toArray(new EntryCache<?>[0]); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any processing that may be required whenever a backend |
| | | * is initialized for use in the Directory Server. This method will |
| | |
| | | // Do nothing. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any processing that may be required whenever a backend |
| | | * is finalized. This method will be invoked after the backend has |
| | |
| | | /** The current dictionary that we should use when performing the validation. */ |
| | | private HashSet<String> dictionary; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this dictionary password validator. |
| | | */ |
| | | /** Creates a new instance of this dictionary password validator. */ |
| | | public DictionaryPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | DictionaryPasswordValidatorCfg configuration) |
| | |
| | | dictionary = loadDictionary(configuration); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeDictionaryChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then the password is acceptable. |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the configured dictionary and returns it as a hash set. |
| | | * |
| | |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | | // Read the contents of file into the dictionary as per the configuration. |
| | | BufferedReader reader = null; |
| | | HashSet<String> dictionary = new HashSet<>(); |
| | |
| | | return dictionary; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | DictionaryPasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | DictionaryPasswordValidatorCfg configuration) |
| | |
| | | public class DigestMD5SASLMechanismHandler |
| | | extends SASLMechanismHandler<DigestMD5SASLMechanismHandlerCfg> |
| | | implements ConfigurationChangeListener<DigestMD5SASLMechanismHandlerCfg> { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The current configuration for this SASL mechanism handler. */ |
| | |
| | | /** Property used to set the realm in the environment. */ |
| | | private static final String REALM_PROPERTY = "com.sun.security.sasl.digest.realm"; |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this SASL mechanism handler. No initialization |
| | | * should be done in this method, as it should all be performed in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSASLMechanismHandler( |
| | | DigestMD5SASLMechanismHandlerCfg configuration) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeSASLMechanismHandler() { |
| | | configuration.removeDigestMD5ChangeListener(this); |
| | | DirectoryServer.deregisterSASLMechanismHandler(SASL_MECHANISM_DIGEST_MD5); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSASLBind(BindOperation bindOp) { |
| | | ClientConnection clientConnection = bindOp.getClientConnection(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isPasswordBased(String mechanism) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSecure(String mechanism) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | DigestMD5SASLMechanismHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | DigestMD5SASLMechanismHandlerCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Retrieves the QOP (quality-of-protection) from the specified |
| | | * configuration. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the fully qualified name either defined in the configuration, or, |
| | | * determined by examining the system configuration. |
| | |
| | | return serverName; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Retrieve the realm either defined in the specified configuration. If this |
| | | * isn't defined, the SaslServer internal code uses the server name. |
| | |
| | | this.handler = handler; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getMonitorInstanceName() { |
| | | return instanceName + "," + "cn=" + baseName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeMonitorProvider(MonitorProviderCfg configuration) |
| | | throws ConfigException, InitializationException { |
| | |
| | | private class HandlerNotifier { |
| | | private File directory; |
| | | private int state; |
| | | /** printable list of handlers names, for reporting backend names in alert messages */ |
| | | /** Printable list of handlers names, for reporting backend names in alert messages. */ |
| | | private final StringBuilder diskNames = new StringBuilder(); |
| | | private final List<MonitoredDirectory> allHandlers = new ArrayList<>(); |
| | | |
| | |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Starts periodic monitoring of all registered directories. |
| | | */ |
| | | /** Starts periodic monitoring of all registered directories. */ |
| | | public void startDiskSpaceMonitor() |
| | | { |
| | | DirectoryServer.registerMonitorProvider(this); |
| | |
| | | { |
| | | synchronized (monitoredDirs) |
| | | { |
| | | |
| | | List<MonitoredDirectory> directories = monitoredDirs.get(directory); |
| | | if (directories != null) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeMonitorProvider(MonitorProviderCfg configuration) |
| | | throws ConfigException, InitializationException { |
| | |
| | | return DiskSpaceMonitor.class.getName(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | |
| | | return alerts; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getShutdownListenerName() |
| | | { |
| | | return INSTANCENAME; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) |
| | | { |
| | |
| | | /** The set of the LDAP URLs that define the membership criteria. */ |
| | | private LinkedHashSet<LDAPURL> memberURLs; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new, uninitialized dynamic group instance. This is intended for |
| | | * internal use only. |
| | | */ |
| | | /** Creates a new, uninitialized dynamic group instance. This is intended for internal use only. */ |
| | | public DynamicGroup() |
| | | { |
| | | super(); |
| | |
| | | // No initialization is required here. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new dynamic group instance with the provided information. |
| | | * |
| | |
| | | this.memberURLs = memberURLs; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeGroupImplementation( |
| | | DynamicGroupImplementationCfg configuration) |
| | |
| | | // No additional initialization is required. |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DynamicGroup newInstance(ServerContext serverContext, Entry groupEntry) |
| | | throws DirectoryException |
| | | { |
| | | ifNull(groupEntry); |
| | | |
| | | |
| | | // Get the memberURL attribute from the entry, if there is one, and parse |
| | | // out the LDAP URLs that it contains. |
| | | LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>(); |
| | |
| | | return new DynamicGroup(groupEntry.getName(), memberURLs); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SearchFilter getGroupDefinitionFilter() |
| | | throws DirectoryException |
| | |
| | | OC_GROUP_OF_URLS + ")"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isGroupDefinition(Entry entry) |
| | | { |
| | |
| | | return entry.hasObjectClass(groupOfURLsClass); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getGroupDN() |
| | | { |
| | | return groupEntryDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setGroupDN(DN groupDN) |
| | | { |
| | | groupEntryDN = groupDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of member URLs for this dynamic group. The returned set |
| | | * must not be altered by the caller. |
| | |
| | | return memberURLs; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsNestedGroups() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<DN> getNestedGroupDNs() |
| | | { |
| | |
| | | return Collections.<DN>emptyList(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMember(DN userDN, Set<DN> examinedGroups) |
| | | throws DirectoryException |
| | |
| | | return entry != null && isMember(entry); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMember(Entry userEntry, Set<DN> examinedGroups) |
| | | throws DirectoryException |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MemberList getMembers() |
| | | throws DirectoryException |
| | |
| | | return new DynamicGroupMemberList(groupEntryDN, memberURLs); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MemberList getMembers(DN baseDN, SearchScope scope, |
| | | SearchFilter filter) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mayAlterMemberList() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateMembers(List<Modification> modifications) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addMember(Entry userEntry) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeMember(DN userDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | buffer.append("})"); |
| | | } |
| | | } |
| | | |
| | |
| | | /** The set of LDAP URLs that define the membership criteria. */ |
| | | private final Set<LDAPURL> memberURLs; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new dynamic group member list with the provided information. |
| | | * |
| | |
| | | this(groupDN, memberURLs, null, null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new dynamic group member list with the provided information. |
| | | * |
| | |
| | | searchesCompleted = false; |
| | | resultQueue = new LinkedBlockingQueue<>(10); |
| | | |
| | | |
| | | // We're going to have to perform one or more internal searches in order to |
| | | // get the results. We need to be careful about the way that we construct |
| | | // them in order to avoid the possibility of getting duplicate results, so |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // At this point, we should know what base DN(s) we need to use, so we can |
| | | // create the filter to use with that base DN. There are some special-case |
| | | // optimizations that we can do here, but in general the filter will look |
| | |
| | | searchMap.put(urlBaseDN, combinedFilter); |
| | | } |
| | | |
| | | |
| | | // At this point, we should have all the information we need to perform the |
| | | // searches. Create arrays of the elements for each. |
| | | DN[] baseDNArray = new DN[baseDNs.size()]; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | DynamicGroupSearchThread searchThread = |
| | | new DynamicGroupSearchThread(this, baseDNArray, filterArray, urlArray); |
| | | searchThread.start(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the DN of the dynamic group with which this dynamic group member |
| | | * list is associated. |
| | |
| | | return groupDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates that all of the searches needed to iterate across the member list |
| | | * have completed and there will not be any more results provided. |
| | |
| | | searchesCompleted = true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Adds the provided entry to the set of results that should be returned for |
| | | * this member list. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Adds the provided membership exception so that it will be thrown along with |
| | | * the set of results for this member list. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasMoreMembers() |
| | | { |
| | |
| | | return resultQueue.peek() != null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry nextMemberEntry() |
| | | throws MembershipException |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | |
| | | resultQueue.clear(); |
| | | } |
| | | } |
| | | |
| | |
| | | extends DirectoryThread |
| | | implements InternalSearchListener |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The set of base DNs for the search requests. */ |
| | |
| | | /** The set of search filters for the search requests. */ |
| | | private final SearchFilter[] searchFilters; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new dynamic group search thread that is associated with the |
| | | * provided member list and that will perform the search using the provided |
| | |
| | | searchCounter = 0; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs the set of searches and provides the results to the associated |
| | | * member list. |
| | | */ |
| | | /** Performs the set of searches and provides the results to the associated member list. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | memberList.setSearchesCompleted(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleInternalSearchEntry(InternalSearchOperation searchOperation, |
| | | SearchResultEntry searchEntry) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleInternalSearchReference( |
| | | InternalSearchOperation searchOperation, |
| | |
| | | // No implementation required. |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Creates a new instance of this entryDN virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this entryDN virtual attribute provider. */ |
| | | public EntryDNVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.create(rule.getAttributeType(), dnString); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, ByteString value) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc}. This virtual attribute will support search operations only |
| | | * if one of the following is true about the search filter: |
| | |
| | | return isSearchable(rule.getAttributeType(), searchOperation.getFilter(), 0); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided search filter is one that may be used with |
| | | * this virtual attribute provider, optionally operating in a recursive manner |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Extracts the user DNs from the provided filter, operating recursively as |
| | | * necessary, and adds them to the provided set. |
| | |
| | | ConfigurationChangeListener |
| | | <ErrorLogAccountStatusNotificationHandlerCfg> |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** The DN of the configuration entry for this notification handler. */ |
| | | private DN configEntryDN; |
| | | |
| | | /** The set of notification types that should generate log messages. */ |
| | | private HashSet<AccountStatusNotificationType> notificationTypes; |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeStatusNotificationHandler( |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration |
| | | ) |
| | |
| | | processNotificationHandlerConfig (configuration, applyChanges); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleStatusNotification( |
| | | AccountStatusNotification notification) |
| | | { |
| | |
| | | notification.getMessage()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | AccountStatusNotificationHandlerCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | configuration, applyChanges); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Makes a best-effort attempt to apply the configuration contained in the |
| | | * provided entry. Information about the result of this processing should be |
| | |
| | | return applyConfigurationChange(configuration); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange ( |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration |
| | | ) |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Parses the provided configuration and configure the notification handler. |
| | | * |
| | |
| | | return isAcceptable; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets the OpenDS notification type object that corresponds to the |
| | | * configuration counterpart. |
| | |
| | | |
| | | return nt; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | /** The set of attributes to return in search result entries. */ |
| | | private LinkedHashSet<String> requestedAttributes; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this exact match identity mapper. All |
| | | * initialization should be performed in the {@code initializeIdentityMapper} |
| | |
| | | // Don't do any initialization here. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeIdentityMapper( |
| | | ExactMatchIdentityMapperCfg configuration) |
| | |
| | | currentConfig = configuration; |
| | | configEntryDN = currentConfig.dn(); |
| | | |
| | | |
| | | // Get the attribute types to use for the searches. Ensure that they are |
| | | // all indexed for equality. |
| | | attributeTypes = |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = newLinkedHashSet("*", "+"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any finalization that may be necessary for this identity mapper. |
| | | */ |
| | | @Override |
| | | public void finalizeIdentityMapper() |
| | | { |
| | | currentConfig.removeExactMatchChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the user entry that was mapped to the provided identification |
| | | * string. |
| | |
| | | ExactMatchIdentityMapperCfg config = currentConfig; |
| | | AttributeType[] attributeTypes = this.attributeTypes; |
| | | |
| | | |
| | | // Construct the search filter to use to make the determination. |
| | | SearchFilter filter; |
| | | if (attributeTypes.length == 1) |
| | |
| | | filter = SearchFilter.createORFilter(filterComps); |
| | | } |
| | | |
| | | |
| | | // Iterate through the set of search bases and process an internal search |
| | | // to find any matching entries. Since we'll only allow a single match, |
| | | // then use size and time limits to constrain costly searches resulting from |
| | |
| | | return matchingEntry; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(IdentityMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ExactMatchIdentityMapperCfg configuration, |
| | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ExactMatchIdentityMapperCfg configuration) |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The reference to the Java runtime used to determine the amount of memory |
| | | * currently in use. |
| | | */ |
| | | /** The reference to the Java runtime used to determine the amount of memory currently in use. */ |
| | | private static final Runtime runtime = Runtime.getRuntime(); |
| | | |
| | | /** The mapping between entry backends/IDs and entries. */ |
| | |
| | | /** The mapping between DNs and entries. */ |
| | | private LinkedHashMap<DN,CacheEntry> dnMap; |
| | | |
| | | /** |
| | | * The lock used to provide threadsafe access when changing the contents of |
| | | * the cache. |
| | | */ |
| | | /** The lock used to provide threadsafe access when changing the contents of the cache. */ |
| | | private ReadWriteLock cacheLock; |
| | | private Lock cacheWriteLock; |
| | | private Lock cacheReadLock; |
| | |
| | | // All initialization should be performed in the initializeEntryCache. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeEntryCache(FIFOEntryCacheCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeEntryCache() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsEntry(DN entryDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(DN entryDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getEntryID(DN entryDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN(String backendID, long entryID) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void putEntry(Entry entry, String backendID, long entryID) |
| | | { |
| | | // Create the cache entry based on the provided information. |
| | | CacheEntry cacheEntry = new CacheEntry(entry, backendID, entryID); |
| | | |
| | | |
| | | // Obtain a lock on the cache. If this fails, then don't do anything. |
| | | try |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // At this point, we hold the lock. No matter what, we must release the |
| | | // lock before leaving this method, so do that in a finally block. |
| | | try |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | map.put(entryID, cacheEntry); |
| | | } |
| | | |
| | | |
| | | // See if a cap has been placed on the maximum number of entries in the |
| | | // cache. If so, then see if we have exceeded it and we need to purge |
| | | // entries until we're within the limit. |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean putEntryIfAbsent(Entry entry, String backendID, long entryID) |
| | | { |
| | | // Create the cache entry based on the provided information. |
| | | CacheEntry cacheEntry = new CacheEntry(entry, backendID, entryID); |
| | | |
| | | |
| | | // Obtain a lock on the cache. If this fails, then don't do anything. |
| | | try |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // At this point, we hold the lock. No matter what, we must release the |
| | | // lock before leaving this method, so do that in a finally block. |
| | | try |
| | |
| | | map.put(entryID, cacheEntry); |
| | | } |
| | | |
| | | |
| | | // See if a cap has been placed on the maximum number of entries in the |
| | | // cache. If so, then see if we have exceeded it and we need to purge |
| | | // entries until we're within the limit. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // We'll always return true in this case, even if we didn't actually add |
| | | // the entry due to memory constraints. |
| | | return true; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeEntry(DN entryDN) |
| | | { |
| | |
| | | // other thread before it releases the lock. |
| | | cacheWriteLock.lock(); |
| | | |
| | | |
| | | // At this point, it is absolutely critical that we always release the lock |
| | | // before leaving this method, so do so in a finally block. |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clear() |
| | | { |
| | |
| | | // been cleared, so we will block until we can obtain the lock. |
| | | cacheWriteLock.lock(); |
| | | |
| | | |
| | | // At this point, it is absolutely critical that we always release the lock |
| | | // before leaving this method, so do so in a finally block. |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearBackend(String backendID) |
| | | { |
| | |
| | | // been cleared, so we will block until we can obtain the lock. |
| | | cacheWriteLock.lock(); |
| | | |
| | | |
| | | // At this point, it is absolutely critical that we always release the lock |
| | | // before leaving this method, so do so in a finally block. |
| | | try |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Unfortunately, there is no good way to dump the entries from the DN |
| | | // cache based on their backend, so we will need to iterate through the |
| | | // entries in the ID map and do it manually. Since this could take a |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearSubtree(DN baseDN) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Acquire a lock on the cache. We should not return until the cache has |
| | | // been cleared, so we will block until we can obtain the lock. |
| | | cacheWriteLock.lock(); |
| | | |
| | | |
| | | // At this point, it is absolutely critical that we always release the lock |
| | | // before leaving this method, so do so in a finally block. |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Clears all entries at or below the specified base DN that are associated |
| | | * with the given backend. The caller must already hold the cache lock. |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Since the provided base DN could hold a subset of the information in the |
| | | // specified backend, we will have to do this by iterating through all the |
| | | // entries for that backend. Since this could take a while, we'll |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // See if the backend has any subordinate backends. If so, then process |
| | | // them recursively. |
| | | for (Backend<?> subBackend : backend.getSubordinateBackends()) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleLowMemory() |
| | | { |
| | | // Grab the lock on the cache and wait until we have it. |
| | | cacheWriteLock.lock(); |
| | | |
| | | |
| | | // At this point, it is absolutely critical that we always release the lock |
| | | // before leaving this method, so do so in a finally block. |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(EntryCacheCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | FIFOEntryCacheCfg configuration, |
| | |
| | | return errorHandler.getIsAcceptable(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( FIFOEntryCacheCfg configuration ) |
| | | { |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Parses the provided configuration and configure the entry cache. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Long getCacheCount() |
| | | { |
| | | return Long.valueOf(dnMap.size()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toVerboseString() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** Performs any finalization that may be necessary for this key manager provider. */ |
| | | @Override |
| | | public void finalizeKeyManagerProvider() |
| | | { |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | |
| | | /** The DN of the configuration entry for this trust manager provider. */ |
| | | private DN configEntryDN; |
| | | |
| | |
| | | /** The trust store type to use. */ |
| | | private String trustStoreType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this file-based trust manager provider. The |
| | | * <CODE>initializeTrustManagerProvider</CODE> method must be called on the |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeTrustManagerProvider( |
| | | FileBasedTrustManagerProviderCfg configuration) |
| | |
| | | configEntryDN = configuration.dn(); |
| | | configuration.addFileBasedChangeListener(this); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | | trustStoreFile = configuration.getTrustStoreFile(); |
| | | File f = getFileForPath(trustStoreFile); |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | |
| | | // Get the trust store type. If none is specified, then use the default |
| | | // type. |
| | | trustStoreType = configuration.getTrustStoreType(); |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | |
| | | // Get the PIN needed to access the contents of the trust store file. We |
| | | // will offer several places to look for the PIN, and we will do so in the |
| | | // following order: |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeTrustManagerProvider() |
| | | { |
| | | currentConfig.removeFileBasedChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public TrustManager[] getTrustManagers() |
| | | throws DirectoryException |
| | |
| | | message, e); |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | String trustManagerAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | TrustManagerProviderCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | FileBasedTrustManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | boolean configAcceptable = true; |
| | | DN cfgEntryDN = configuration.dn(); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | | String newTrustStoreFile = configuration.getTrustStoreFile(); |
| | | try |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // Check to see if the trust store type is acceptable. |
| | | String storeType = configuration.getTrustStoreType(); |
| | | if (storeType != null) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If there is a PIN property, then make sure the corresponding |
| | | // property is set. |
| | | String pinProp = configuration.getTrustStorePinProperty(); |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // If there is a PIN environment variable, then make sure the corresponding |
| | | // environment variable is set. |
| | | String pinEnVar = configuration.getTrustStorePinEnvironmentVariable(); |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // If there is a PIN file, then make sure the file exists and is readable. |
| | | String pinFile = configuration.getTrustStorePinFile(); |
| | | if (pinFile != null) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedTrustManagerProviderCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | | String newTrustStoreFile = configuration.getTrustStoreFile(); |
| | | File f = getFileForPath(newTrustStoreFile); |
| | |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // Get the PIN needed to access the contents of the trust store file. We |
| | | // will offer several places to look for the PIN, and we will do so in the |
| | | // following order: |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | trustStoreFile = newTrustStoreFile; |
| | |
| | | /** The iterator used to traverse the set of member DNs. */ |
| | | private Iterator<CompactDn> memberDNIterator; |
| | | |
| | | /** |
| | | * The membership exception that should be thrown the next time a member is |
| | | * requested. |
| | | */ |
| | | /** The membership exception that should be thrown the next time a member is requested. */ |
| | | private MembershipException nextMembershipException; |
| | | |
| | | /** The search filter that all returned members should match. */ |
| | |
| | | nextMembershipException = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasMoreMembers() |
| | | { |
| | |
| | | && (nextMatchingEntry != null || nextMembershipException != null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN nextMemberDN() throws MembershipException |
| | | { |
| | |
| | | return entry != null ? entry.getName() : null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry nextMemberEntry() throws MembershipException |
| | | { |
| | |
| | | return e; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | } |
| | | |
| | |
| | | /** The set of attributes to return in search result entries. */ |
| | | private LinkedHashSet<String> requestedAttributes; |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this certificate mapper. Note that all actual |
| | | * initialization should be done in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeCertificateMapper( |
| | | FingerprintCertificateMapperCfg configuration) |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | // Make sure that the fingerprint attribute is configured for equality in |
| | | // all appropriate backends. |
| | | Set<DN> cfgBaseDNs = configuration.getUserBaseDN(); |
| | |
| | | requestedAttributes = newLinkedHashSet("*", "+"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeCertificateMapper() |
| | | { |
| | | currentConfig.removeFingerprintChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry mapCertificateToUser(Certificate[] certificateChain) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the first certificate in the chain. It must be an X.509 certificate. |
| | | X509Certificate peerCertificate; |
| | | try |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the signature from the peer certificate and create a digest of it |
| | | // using the configured algorithm. |
| | | String fingerprintString; |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Create the search filter from the fingerprint. |
| | | ByteString value = ByteString.valueOfUtf8(fingerprintString); |
| | | SearchFilter filter = |
| | | SearchFilter.createEqualityFilter(fingerprintAttributeType, value); |
| | | |
| | | |
| | | // If we have an explicit set of base DNs, then use it. Otherwise, use the |
| | | // set of public naming contexts in the server. |
| | | Collection<DN> baseDNs = config.getUserBaseDN(); |
| | |
| | | baseDNs = DirectoryServer.getPublicNamingContexts().keySet(); |
| | | } |
| | | |
| | | |
| | | // For each base DN, issue an internal search in an attempt to map the |
| | | // certificate. |
| | | Entry userEntry = null; |
| | |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_CREDENTIALS, message); |
| | | |
| | | |
| | | case TIME_LIMIT_EXCEEDED: |
| | | case ADMIN_LIMIT_EXCEEDED: |
| | | // The search criteria was too inefficient. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then we either found exactly one user entry or we |
| | | // didn't find any. Either way, return the entry or null to the caller. |
| | | return userEntry; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(CertificateMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | FingerprintCertificateMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FingerprintCertificateMapperCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the algorithm that will be used to generate the fingerprint. |
| | | String newFingerprintAlgorithm = null; |
| | | switch (configuration.getFingerprintAlgorithm()) |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | fingerprintAlgorithm = newFingerprintAlgorithm; |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | /** The identity mapper that will be used to map identities. */ |
| | | private IdentityMapper<?> identityMapper; |
| | | |
| | | /** |
| | | * The properties to use when creating a SASL server to process the |
| | | * GSSAPI authentication. |
| | | */ |
| | | /** The properties to use when creating a SASL server to process the GSSAPI authentication. */ |
| | | private HashMap<String, String> saslProps; |
| | | |
| | | /** The fully qualified domain name used when creating the SASL server. */ |
| | |
| | | private volatile LoginContext loginContext; |
| | | private final Object loginContextLock = new Object(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this SASL mechanism handler. No |
| | | * initialization should be done in this method, as it should all be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSASLMechanismHandler( |
| | | GSSAPISASLMechanismHandlerCfg configuration) throws ConfigException, |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Checks to make sure that the ds-cfg-kdc-address and dc-cfg-realm |
| | | * are both defined in the configuration. If only one is set, then |
| | |
| | | { |
| | | System.setProperty(KRBV_PROPERTY_KDC, kdcAddress); |
| | | System.setProperty(KRBV_PROPERTY_REALM, realm); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * During login, callbacks are usually used to prompt for passwords. |
| | | * All of the GSSAPI login information is provided in the properties |
| | |
| | | { |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the fully qualified name either defined in the |
| | | * configuration, or, determined by examining the system |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * Return the login context. If it's not been initialized yet, |
| | | * create a login context or login using the principal and keytab |
| | | * information specified in the configuration. |
| | |
| | | return loginContext; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Logout of the current login context. |
| | | */ |
| | | /** Logout of the current login context. */ |
| | | private void logout() |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates an login.conf file from information in the specified |
| | | * configuration. This file is used during the login phase. |
| | |
| | | return configFileName; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeSASLMechanismHandler() { |
| | | logout(); |
| | |
| | | logger.error(INFO_GSSAPI_STOPPED); |
| | | } |
| | | |
| | | |
| | | private void clearProperties() { |
| | | System.clearProperty(KRBV_PROPERTY_KDC); |
| | | System.clearProperty(KRBV_PROPERTY_REALM); |
| | |
| | | System.clearProperty(JAAS_PROPERTY_SUBJECT_CREDS_ONLY); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSASLBind(BindOperation bindOp) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the underlying GSSException messages that really tell what the |
| | | * problem is. The major code is the GSS-API status and the minor is the |
| | |
| | | return message.toMessage(); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isPasswordBased(String mechanism) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSecure(String mechanism) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | SASLMechanismHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(newConfig, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | GSSAPISASLMechanismHandlerCfg newConfiguration, |
| | |
| | | return isAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(GSSAPISASLMechanismHandlerCfg newConfiguration) |
| | | { |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeExtendedOperationHandler( |
| | | GetConnectionIdExtendedOperationHandlerCfg config) |
| | |
| | | super.initializeExtendedOperationHandler(config); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processExtendedOperation(ExtendedOperation operation) |
| | | { |
| | |
| | | operation.setResultCode(ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Encodes the provided connection ID in an octet string suitable for use as |
| | | * the value for this extended operation. |
| | |
| | | return builder.toByteString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Decodes the provided ASN.1 octet string to extract the connection ID. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationOID() |
| | | { |
| | | return OID_GET_CONNECTION_ID_EXTOP; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationName() |
| | | { |
| | |
| | | public class GoverningStructureRuleVirtualAttributeProvider extends |
| | | VirtualAttributeProvider<GoverningStructureRuleVirtualAttributeCfg> |
| | | { |
| | | /** |
| | | * Creates a new instance of this governingStructureRule virtual attribute |
| | | * provider. |
| | | */ |
| | | /** Creates a new instance of this governingStructureRule virtual attribute provider. */ |
| | | public GoverningStructureRuleVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.empty(rule.getAttributeType()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | return getDITStructureRule(entry)!=null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | return ditRule; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Creates a new instance of this HasSubordinates virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this HasSubordinates virtual attribute provider. */ |
| | | public HasSubordinatesVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.empty(rule.getAttributeType()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, ByteString value) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | searchOperation.appendErrorMessage(message); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Creates a new instance of this entryDN virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this entryDN virtual attribute provider. */ |
| | | public IsMemberOfVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return builder.toAttribute(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, |
| | | ByteString value) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc}. This virtual attribute will support search operations only |
| | | * if one of the following is true about the search filter: |
| | |
| | | isSearchable(rule.getAttributeType(), searchOperation.getFilter(), 0); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided search filter is one that may be used with |
| | | * this virtual attribute provider, optionally operating in a recursive manner |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param searchOperation the search operation being processed. |
| | | * @param memberList the list of members of the group being processed. |
| | | * @param returnedDNs a set to store the normalized DNs of entries already returned, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Extracts the first group DN encountered in the provided filter, operating |
| | | * recursively as necessary. |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.JMXAlertHandler"; |
| | | |
| | | |
| | | |
| | | /** The current configuration for this alert handler. */ |
| | | private AlertHandlerCfg currentConfig; |
| | | |
| | | /** The sequence number generator used for this alert handler. */ |
| | | private AtomicLong sequenceNumber; |
| | | |
| | | /** |
| | | * The DN of the configuration entry with which this alert handler is |
| | | * associated. |
| | | */ |
| | | /** The DN of the configuration entry with which this alert handler is associated. */ |
| | | private DN configEntryDN; |
| | | |
| | | /** The JMX object name used for this JMX alert handler. */ |
| | | private ObjectName objectName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this JMX alert handler. No initialization should |
| | | * be done here, as it should all be performed in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeAlertHandler(JMXAlertHandlerCfg configuration) |
| | | throws ConfigException, InitializationException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AlertHandlerCfg getAlertHandlerConfiguration() |
| | | { |
| | | return currentConfig; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(AlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | return isConfigurationChangeAcceptable(cfg, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeAlertHandler() |
| | | { |
| | | // No action is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the JMX object name for this JMX alert handler. |
| | | * |
| | | * @return The JMX object name for this JMX alert handler. |
| | | */ |
| | | @Override |
| | | public ObjectName getObjectName() |
| | | { |
| | | return objectName; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void sendAlertNotification(AlertGenerator generator, String alertType, |
| | | LocalizableMessage alertMessage) |
| | | { |
| | |
| | | alertMessage.toString())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves information about the types of JMX notifications that may be |
| | | * generated. |
| | |
| | | * @return Information about the types of JMX notifications that may be |
| | | * generated. |
| | | */ |
| | | @Override |
| | | public MBeanNotificationInfo[] getNotificationInfo() |
| | | { |
| | | ArrayList<MBeanNotificationInfo> notifications = new ArrayList<>(); |
| | |
| | | return notifications.toArray(new MBeanNotificationInfo[notifications.size()]); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Obtain the value of a specific attribute of the Dynamic MBean. |
| | | * |
| | |
| | | * @throws AttributeNotFoundException If the specified attribute is not |
| | | * associated with this MBean. |
| | | */ |
| | | @Override |
| | | public Attribute getAttribute(String attribute) |
| | | throws AttributeNotFoundException |
| | | { |
| | |
| | | throw new AttributeNotFoundException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set the value of a specific attribute of the Dynamic MBean. |
| | | * |
| | |
| | | * @throws InvalidAttributeValueException If the provided value is not |
| | | * acceptable for this MBean. |
| | | */ |
| | | @Override |
| | | public void setAttribute(Attribute attribute) |
| | | throws AttributeNotFoundException, InvalidAttributeValueException |
| | | { |
| | |
| | | throw new AttributeNotFoundException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the values of several attributes of the Dynamic MBean. |
| | | * |
| | |
| | | * |
| | | * @return The list of attributes retrieved. |
| | | */ |
| | | @Override |
| | | public AttributeList getAttributes(String[] attributes) |
| | | { |
| | | // There are no attributes for this MBean. |
| | | return new AttributeList(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the values of several attributes of the Dynamic MBean. |
| | | * |
| | |
| | | * |
| | | * @return The list of attributes that were set with their new values. |
| | | */ |
| | | @Override |
| | | public AttributeList setAttributes(AttributeList attributes) |
| | | { |
| | | // There are no attributes for this MBean. |
| | | return new AttributeList(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Allows an action to be invoked on the Dynamic MBean. |
| | | * |
| | |
| | | * @throws MBeanException If a problem is encountered while invoking the |
| | | * method. |
| | | */ |
| | | @Override |
| | | public Object invoke(String actionName, Object[] params, String[] signature) |
| | | throws MBeanException |
| | | { |
| | |
| | | throw new MBeanException(new ConfigException(message)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Provides the exposed attributes and actions of the Dynamic MBean using an |
| | | * MBeanInfo object. |
| | |
| | | * @return An instance of <CODE>MBeanInfo</CODE> allowing all attributes and |
| | | * actions exposed by this Dynamic MBean to be retrieved. |
| | | */ |
| | | @Override |
| | | public MBeanInfo getMBeanInfo() |
| | | { |
| | | return new MBeanInfo(CLASS_NAME, "JMX Alert Handler", |
| | |
| | | new MBeanOperationInfo[0], getNotificationInfo()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | JMXAlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | JMXAlertHandlerCfg configuration) |
| | | { |
| | |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * LDAP pass through authentication policy implementation. |
| | | */ |
| | | /** LDAP pass through authentication policy implementation. */ |
| | | public final class LDAPPassThroughAuthenticationPolicyFactory implements |
| | | AuthenticationPolicyFactory<LDAPPassThroughAuthenticationPolicyCfg> |
| | | { |
| | | |
| | | // TODO: handle password policy response controls? AD? |
| | | // TODO: custom aliveness pings |
| | | // TODO: improve debug logging and error messages. |
| | |
| | | static abstract class AbstractLoadBalancer implements ConnectionFactory, |
| | | Runnable |
| | | { |
| | | /** |
| | | * A connection which automatically retries operations on other servers. |
| | | */ |
| | | /** A connection which automatically retries operations on other servers. */ |
| | | private final class FailoverConnection implements Connection |
| | | { |
| | | private Connection connection; |
| | |
| | | private final int startIndex; |
| | | private int nextIndex; |
| | | |
| | | |
| | | |
| | | private FailoverConnection(final int startIndex) |
| | | throws DirectoryException |
| | | { |
| | |
| | | throw lastException; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | | connection.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString search(final DN baseDN, final SearchScope scope, |
| | | final SearchFilter filter) throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void simpleBind(final ByteString username, |
| | | final ByteString password) throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void handleDirectoryException(final DirectoryException e) |
| | | throws DirectoryException |
| | | { |
| | |
| | | throw e; |
| | | } |
| | | |
| | | |
| | | |
| | | private void incrementNextIndex() |
| | | { |
| | | // Try the next index. |
| | |
| | | nextIndex = 0; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * A connection factory which caches its online/offline state in order to |
| | | * avoid unnecessary connection attempts when it is known to be offline. |
| | |
| | | private volatile boolean isAvailable = true; |
| | | private DirectoryException lastException; |
| | | |
| | | |
| | | |
| | | private MonitoredConnectionFactory(final ConnectionFactory factory) |
| | | { |
| | | this.factory = factory; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | | factory.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Connection getConnection() throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private final MonitoredConnectionFactory[] factories; |
| | | private final int maxIndex; |
| | | private final ScheduledFuture<?> monitorFuture; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new abstract load-balancer. |
| | | * |
| | |
| | | TimeUnit.SECONDS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Close underlying connection pools. |
| | | */ |
| | | /** Close underlying connection pools. */ |
| | | @Override |
| | | public final void close() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final Connection getConnection() throws DirectoryException |
| | | { |
| | |
| | | return new FailoverConnection(startIndex); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Try to connect to any offline connection factories. |
| | | */ |
| | | /** Try to connect to any offline connection factories. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Return the start which should be used for the next connection attempt. |
| | | * |
| | | * @return The start which should be used for the next connection attempt. |
| | | */ |
| | | abstract int getStartIndex(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * A factory which returns pre-authenticated connections for searches. |
| | | * <p> |
| | |
| | | static final class AuthenticatedConnectionFactory implements |
| | | ConnectionFactory |
| | | { |
| | | |
| | | private final ConnectionFactory factory; |
| | | private final DN username; |
| | | private final String password; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new authenticated connection factory which will bind on |
| | | * connect. |
| | |
| | | this.password = password; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | | factory.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Connection getConnection() throws DirectoryException |
| | | { |
| | |
| | | } |
| | | return connection; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * An LDAP connection which will be used in order to search for or |
| | | * authenticate users. |
| | | */ |
| | | /** An LDAP connection which will be used in order to search for or authenticate users. */ |
| | | static interface Connection extends Closeable |
| | | { |
| | | |
| | | /** |
| | | * Closes this connection. |
| | | */ |
| | | /** Closes this connection. */ |
| | | @Override |
| | | void close(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the name of the user whose entry matches the provided search |
| | | * criteria. This will return CLIENT_SIDE_NO_RESULTS_RETURNED/NO_SUCH_OBJECT |
| | |
| | | ByteString search(DN baseDN, SearchScope scope, SearchFilter filter) |
| | | throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs a simple bind for the user. |
| | | * |
| | |
| | | throws DirectoryException; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * An interface for obtaining connections: users of this interface will obtain |
| | | * a connection, perform a single operation (search or bind), and then close |
| | |
| | | @Override |
| | | void close(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns a connection which can be used in order to search for or |
| | | * authenticate users. |
| | |
| | | */ |
| | | static final class ConnectionPool implements ConnectionFactory |
| | | { |
| | | |
| | | /** |
| | | * Pooled connection's intercept close and release connection back to the |
| | | * pool. |
| | | */ |
| | | /** Pooled connection's intercept close and release connection back to the pool. */ |
| | | private final class PooledConnection implements Connection |
| | | { |
| | | private Connection connection; |
| | | private boolean connectionIsClosed; |
| | | |
| | | |
| | | |
| | | private PooledConnection(final Connection connection) |
| | | { |
| | | this.connection = connection; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString search(final DN baseDN, final SearchScope scope, |
| | | final SearchFilter filter) throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void simpleBind(final ByteString username, |
| | | final ByteString password) throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void closeIfConnectionFailure(final DirectoryException e) |
| | | throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void reconnectIfConnectionFailure(final DirectoryException e) |
| | | throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** Guarded by PolicyImpl.lock. */ |
| | | private boolean poolIsClosed; |
| | | |
| | |
| | | private final Semaphore availableConnections = new Semaphore(poolSize); |
| | | private final Queue<Connection> connectionPool = new ConcurrentLinkedQueue<>(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new connection pool for the provided factory. |
| | | * |
| | |
| | | this.factory = factory; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Release all connections: do we want to block? |
| | | */ |
| | | /** Release all connections: do we want to block? */ |
| | | @Override |
| | | public void close() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Connection getConnection() throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * A simplistic two-way fail-over connection factory implementation. |
| | | * <p> |
| | |
| | | */ |
| | | static final class FailoverLoadBalancer extends AbstractLoadBalancer |
| | | { |
| | | |
| | | /** |
| | | * Creates a new fail-over connection factory which will always try the |
| | | * primary connection factory first, before trying the second. |
| | |
| | | super(new ConnectionFactory[] { primary, secondary }, scheduler); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | int getStartIndex() |
| | | { |
| | | // Always start with the primaries. |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * The PTA design guarantees that connections are only used by a single thread |
| | | * at a time, so we do not need to perform any synchronization. |
| | |
| | | */ |
| | | static final class LDAPConnectionFactory implements ConnectionFactory |
| | | { |
| | | /** |
| | | * LDAP connection implementation. |
| | | */ |
| | | /** LDAP connection implementation. */ |
| | | private final class LDAPConnection implements Connection |
| | | { |
| | | private final Socket plainSocket; |
| | |
| | | private int nextMessageID = 1; |
| | | private boolean isClosed; |
| | | |
| | | |
| | | |
| | | private LDAPConnection(final Socket plainSocket, final Socket ldapSocket, |
| | | final LDAPReader reader, final LDAPWriter writer) |
| | | { |
| | |
| | | this.writer = writer; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | |
| | | StaticUtils.close(ldapSocket, plainSocket); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString search(final DN baseDN, final SearchScope scope, |
| | | final SearchFilter filter) throws DirectoryException |
| | |
| | | return username; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void simpleBind(final ByteString username, |
| | | final ByteString password) throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void finalize() |
| | | { |
| | | close(); |
| | | } |
| | | |
| | | |
| | | |
| | | private void handleUnexpectedResponse(final LDAPMessage responseMessage) |
| | | throws DirectoryException |
| | | { |
| | |
| | | cfg.dn(), responseMessage.getProtocolOp())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** Reads a response message and adapts errors to directory exceptions. */ |
| | | private LDAPMessage readResponse() throws DirectoryException |
| | | { |
| | |
| | | return responseMessage; |
| | | } |
| | | |
| | | |
| | | |
| | | /** Sends a request message and adapts errors to directory exceptions. */ |
| | | private void sendRequest(final ProtocolOp request) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private final String host; |
| | | private final int port; |
| | | private final LDAPPassThroughAuthenticationPolicyCfg cfg; |
| | | private final int timeoutMS; |
| | | |
| | | |
| | | |
| | | /** |
| | | * LDAP connection factory implementation is package private so that it can |
| | | * be tested. |
| | |
| | | Integer.MAX_VALUE); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Connection getConnection() throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * An interface for obtaining a connection factory for LDAP connections to a |
| | | * named LDAP server and the monitoring scheduler. |
| | |
| | | ConnectionFactory getLDAPConnectionFactory(String host, int port, |
| | | LDAPPassThroughAuthenticationPolicyCfg cfg); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the scheduler which should be used to periodically ping |
| | | * connection factories to determine when they are online. |
| | |
| | | */ |
| | | ScheduledExecutorService getScheduledExecutorService(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the current time in order to perform cached password expiration |
| | | * checks. The returned string will be formatted as a a generalized time |
| | |
| | | */ |
| | | String getCurrentTime(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the current time in order to perform cached password expiration |
| | | * checks. |
| | |
| | | long getCurrentTimeMS(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * A simplistic load-balancer connection factory implementation using |
| | | * approximately round-robin balancing. |
| | |
| | | private final AtomicInteger nextIndex = new AtomicInteger(); |
| | | private final int maxIndex; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new load-balancer which will distribute connection requests |
| | | * across a set of underlying connection factories. |
| | |
| | | this.maxIndex = factories.length; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | int getStartIndex() |
| | | { |
| | |
| | | // connection factory. |
| | | return oldNextIndex; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * LDAP PTA policy implementation. |
| | | */ |
| | | /** LDAP PTA policy implementation. */ |
| | | private final class PolicyImpl extends AuthenticationPolicy implements |
| | | ConfigurationChangeListener<LDAPPassThroughAuthenticationPolicyCfg> |
| | | { |
| | | |
| | | /** |
| | | * LDAP PTA policy state implementation. |
| | | */ |
| | | /** LDAP PTA policy state implementation. */ |
| | | private final class StateImpl extends AuthenticationPolicyState |
| | | { |
| | | |
| | | private final AttributeType cachedPasswordAttribute; |
| | | private final AttributeType cachedPasswordTimeAttribute; |
| | | |
| | | private ByteString newCachedPassword; |
| | | |
| | | |
| | | |
| | | |
| | | private StateImpl(final Entry userEntry) |
| | | { |
| | | super(userEntry); |
| | |
| | | this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeStateAfterBind() throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AuthenticationPolicy getAuthenticationPolicy() |
| | | { |
| | | return PolicyImpl.this; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(final ByteString password) |
| | | throws DirectoryException |
| | |
| | | |
| | | if (username == null) |
| | | { |
| | | /* |
| | | * No matching entries were found in the remote directory. |
| | | */ |
| | | /* No matching entries were found in the remote directory. */ |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, |
| | | ERR_LDAP_PTA_MAPPED_SEARCH_NO_CANDIDATES.get( |
| | | userEntry.getName(), cfg.dn(), filter)); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private boolean passwordMatchesCachedPassword(ByteString password) |
| | | { |
| | | if (!cfg.isUsePasswordCaching()) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // Guards against configuration changes. |
| | | /** Guards against configuration changes. */ |
| | | private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
| | | private final ReadLock sharedLock = lock.readLock(); |
| | | private final WriteLock exclusiveLock = lock.writeLock(); |
| | |
| | | |
| | | private PasswordStorageScheme<?> pwdStorageScheme; |
| | | |
| | | |
| | | |
| | | private PolicyImpl( |
| | | final LDAPPassThroughAuthenticationPolicyCfg configuration) |
| | | { |
| | | initializeConfiguration(configuration); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | final LDAPPassThroughAuthenticationPolicyCfg cfg) |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AuthenticationPolicyState createAuthenticationPolicyState( |
| | | final Entry userEntry, final long time) throws DirectoryException |
| | |
| | | return new StateImpl(userEntry); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeAuthenticationPolicy() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getDN() |
| | | { |
| | | return cfg.dn(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | final LDAPPassThroughAuthenticationPolicyCfg cfg, |
| | |
| | | .isConfigurationAcceptable(cfg, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | private void closeConnections() |
| | | { |
| | | exclusiveLock.lock(); |
| | |
| | | bindFactory.close(); |
| | | bindFactory = null; |
| | | } |
| | | |
| | | } |
| | | finally |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void initializeConfiguration( |
| | | final LDAPPassThroughAuthenticationPolicyCfg cfg) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private ConnectionFactory newLDAPConnectionFactory(final String hostPort) |
| | | { |
| | | // Validation already performed by admin framework. |
| | | final HostPort hp = HostPort.valueOf(hostPort); |
| | | return provider.getLDAPConnectionFactory(hp.getHost(), hp.getPort(), cfg); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** Debug tracer for this class. */ |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ConnectionFactory getLDAPConnectionFactory(final String host, |
| | | final int port, final LDAPPassThroughAuthenticationPolicyCfg cfg) |
| | |
| | | return new LDAPConnectionFactory(host, port, cfg); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ScheduledExecutorService getScheduledExecutorService() |
| | | { |
| | |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Determines whether or no a result code is expected to trigger the |
| | | * associated connection to be closed immediately. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the search bind password performing mapped searches. |
| | | * We will offer several places to look for the password, and we will |
| | |
| | | return password; |
| | | } |
| | | |
| | | |
| | | |
| | | private static boolean isServerAddressValid( |
| | | final LDAPPassThroughAuthenticationPolicyCfg configuration, |
| | | final List<LocalizableMessage> unacceptableReasons, final String hostPort) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private static String mappedAttributesAsString( |
| | | final Collection<AttributeType> attributes) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Public default constructor used by the admin framework. This will use the |
| | | * default LDAP connection factory provider. |
| | |
| | | this.provider = provider; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AuthenticationPolicy createAuthenticationPolicy( |
| | | final LDAPPassThroughAuthenticationPolicyCfg configuration) |
| | |
| | | return policy; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | final LDAPPassThroughAuthenticationPolicyCfg cfg, |
| | |
| | | /** The current configuration for this password validator. */ |
| | | private LengthBasedPasswordValidatorCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password validator. |
| | | */ |
| | | /** Creates a new instance of this password validator. */ |
| | | public LengthBasedPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | LengthBasedPasswordValidatorCfg configuration) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeLengthBasedChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | LengthBasedPasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LengthBasedPasswordValidatorCfg configuration) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * MD5 algorithm defined in RFC 1321. This is a one-way digest algorithm |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.MD5PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** The message digest that will actually be used to generate the MD5 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | | /** The lock used to provide threadsafe access to the message digest. */ |
| | | private Object digestLock; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | public MD5PasswordStorageScheme() |
| | | { |
| | | super(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | MD5PasswordStorageSchemeCfg configuration) |
| | |
| | | digestLock = new Object(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_MD5; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(digestBytes)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | |
| | | buffer.append(Base64.encode(digestBytes)); |
| | | |
| | | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return userPWDigestBytes.equals(storedPWDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | /** The current configuration for this member virtual attribute. */ |
| | | private MemberVirtualAttributeCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this member virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this member virtual attribute provider. */ |
| | | public MemberVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeVirtualAttributeProvider( |
| | | MemberVirtualAttributeCfg configuration) |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return builder.toAttribute(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, ByteString value) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | MemberVirtualAttributeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | MemberVirtualAttributeCfg configuration) |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public class NotificationMessageNotificationMessageTemplateElement |
| | | extends NotificationMessageTemplateElement |
| | | { |
| | | /** |
| | | * Creates a new notification message notification message template element. |
| | | */ |
| | | /** Creates a new notification message notification message template element. */ |
| | | public NotificationMessageNotificationMessageTemplateElement() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void generateValue(LocalizableMessageBuilder buffer, |
| | | AccountStatusNotification notification) |
| | | { |
| | | buffer.append(notification.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | /** The account status notification property for which to obtain the value. */ |
| | | private AccountStatusNotificationProperty property; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new notification property notification message template element. |
| | | * |
| | |
| | | this.property = property; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void generateValue(LocalizableMessageBuilder buffer, |
| | | AccountStatusNotification notification) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public class NotificationTypeNotificationMessageTemplateElement |
| | | extends NotificationMessageTemplateElement |
| | | { |
| | | /** |
| | | * Creates a new notification type notification message template element. |
| | | */ |
| | | /** Creates a new notification type notification message template element. */ |
| | | public NotificationTypeNotificationMessageTemplateElement() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void generateValue(LocalizableMessageBuilder buffer, |
| | | AccountStatusNotification notification) |
| | | { |
| | | buffer.append(notification.getNotificationType().getName()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public class NullKeyManagerProvider |
| | | extends KeyManagerProvider<KeyManagerProviderCfg>{ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this null key manager provider. The |
| | | * <CODE>initializeKeyManagerProvider</CODE> method must be called on the |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeKeyManagerProvider( |
| | | KeyManagerProviderCfg configuration) throws ConfigException, |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any finalization that may be necessary for this key manager |
| | | * provider. |
| | | */ |
| | | @Override |
| | | public void finalizeKeyManagerProvider() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a <CODE>KeyManager</CODE> object that may be used for |
| | | * interactions requiring access to a key manager. |
| | |
| | | * @throws DirectoryException If a problem occurs while attempting to obtain |
| | | * the set of key managers. |
| | | */ |
| | | @Override |
| | | public KeyManager[] getKeyManagers() |
| | | throws DirectoryException |
| | | { |
| | | return new KeyManager[0]; |
| | | } |
| | | } |
| | | |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeTrustManagerProvider( |
| | | TrustManagerProviderCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any finalization that may be necessary for this trust manager |
| | | * provider. |
| | | */ |
| | | @Override |
| | | public void finalizeTrustManagerProvider() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a <CODE>TrustManager</CODE> object that may be used for |
| | | * interactions requiring access to a trust manager. |
| | |
| | | * @throws DirectoryException If a problem occurs while attempting to obtain |
| | | * the set of trust managers. |
| | | */ |
| | | @Override |
| | | public TrustManager[] getTrustManagers() |
| | | throws DirectoryException |
| | | { |
| | | return new TrustManager[0]; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Creates a new instance of this NumSubordinates virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this NumSubordinates virtual attribute provider. */ |
| | | public NumSubordinatesVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.empty(rule.getAttributeType()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, ByteString value) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | searchOperation.appendErrorMessage(message); |
| | | } |
| | | } |
| | | |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme(PBKDF2PasswordStorageSchemeCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | config.addPBKDF2ChangeListener(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(PBKDF2PasswordStorageSchemeCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(PBKDF2PasswordStorageSchemeCfg configuration) |
| | | { |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_PBKDF2; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(iterations + ":" + Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8('{' + STORAGE_SCHEME_NAME_PBKDF2 + '}' + encodePassword(plaintext)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, ByteSequence storedPassword) { |
| | | // Split the iterations from the stored value (separated by a ':') |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_PBKDF2; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | + iterations + ':' + Base64.encode(saltBytes) + '$' + Base64.encode(digestBytes)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, String authInfo, String authValue) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, String authValue) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Generates an encoded password string from the given clear-text password. |
| | | * This method is primarily intended for use when it is necessary to generate a password with the server |
| | |
| | | System.arraycopy(saltBytes, 0, hashPlusSalt, digestBytes.length, NUM_SALT_BYTES); |
| | | return hashPlusSalt; |
| | | } |
| | | |
| | | } |
| | |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | |
| | | import java.io.IOException; |
| | | import java.security.KeyStore; |
| | | import java.util.List; |
| | | |
| | | import javax.net.ssl.KeyManager; |
| | | import javax.net.ssl.KeyManagerFactory; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.server.config.server.PKCS11KeyManagerProviderCfg; |
| | | import org.opends.server.api.KeyManagerProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a key manager provider that will access keys stored on a |
| | | * PKCS#11 device. It will use the Java PKCS#11 interface, which may need to be |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * The keystore type to use when accessing the PKCS#11 keystore. |
| | | */ |
| | | /** The keystore type to use when accessing the PKCS#11 keystore. */ |
| | | public static final String PKCS11_KEYSTORE_TYPE = "PKCS11"; |
| | | |
| | | |
| | | |
| | | /** The DN of the configuration entry for this key manager provider. */ |
| | | private DN configEntryDN; |
| | | |
| | |
| | | /** The current configuration for this key manager provider. */ |
| | | private PKCS11KeyManagerProviderCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this PKCS#11 key manager provider. The |
| | | * <CODE>initializeKeyManagerProvider</CODE> method must be called on the |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeKeyManagerProvider( |
| | | PKCS11KeyManagerProviderCfg configuration) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any finalization that may be necessary for this key |
| | | * manager provider. |
| | | */ |
| | | @Override |
| | | public void finalizeKeyManagerProvider() |
| | | { |
| | | currentConfig.removePKCS11ChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a set of <CODE>KeyManager</CODE> objects that may be used for |
| | | * interactions requiring access to a key manager. |
| | | * |
| | | * @return A set of <CODE>KeyManager</CODE> objects that may be used for |
| | | * interactions requiring access to a key manager. |
| | | * |
| | | * @throws DirectoryException If a problem occurs while attempting to obtain |
| | | * the set of key managers. |
| | | */ |
| | | @Override |
| | | public KeyManager[] getKeyManagers() |
| | | throws DirectoryException |
| | | { |
| | |
| | | message, e); |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | String keyManagerAlgorithm = KeyManagerFactory.getDefaultAlgorithm(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | PKCS11KeyManagerProviderCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(configuration, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PKCS11KeyManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PKCS11KeyManagerProviderCfg configuration) |
| | | { |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme(PKCS5S2PasswordStorageSchemeCfg configuration) |
| | | throws InitializationException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_PKCS5S2; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8('{' + STORAGE_SCHEME_NAME_PKCS5S2 + '}' + encodePassword(plaintext)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, ByteSequence storedPassword) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_PKCS5S2; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | + ':' + Base64.encode(saltBytes) + '$' + Base64.encode(digestBytes)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, String authInfo, String authValue) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, String authValue) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates an encoded password string from the given clear-text password. |
| | | * This method is primarily intended for use when it is necessary to generate a password with the server |
| | |
| | | System.arraycopy(digestBytes, 0, hashPlusSalt, NUM_SALT_BYTES, digestBytes.length); |
| | | return hashPlusSalt; |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The maximum number of times to retry getting the next operation from the |
| | | * queue if an unexpected failure occurs. |
| | | */ |
| | | private static final int MAX_RETRY_COUNT = 5; |
| | | |
| | | |
| | | |
| | | /** The set of worker threads that will be used to process this work queue. */ |
| | | private ArrayList<ParallelWorkerThread> workerThreads; |
| | | |
| | | /** |
| | | * The number of operations that have been submitted to the work queue for |
| | | * processing. |
| | | */ |
| | | /** The number of operations that have been submitted to the work queue for processing. */ |
| | | private AtomicLong opsSubmitted; |
| | | |
| | | /** |
| | |
| | | /** The lock used to provide threadsafe access for the queue. */ |
| | | private final Object queueLock = new Object(); |
| | | |
| | | |
| | | private final Semaphore queueSemaphore = new Semaphore(0, false); |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this work queue. All initialization should be |
| | | * performed in the <CODE>initializeWorkQueue</CODE> method. |
| | |
| | | // No implementation should be performed here. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeWorkQueue(ParallelWorkQueueCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | workerThreads.add(t); |
| | | } |
| | | |
| | | |
| | | // Create and register a monitor provider for the work queue. |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeWorkQueue(LocalizableMessage reason) |
| | | { |
| | | shutdownRequested = true; |
| | | |
| | | |
| | | // Send responses to any operations in the pending queue to indicate that |
| | | // they won't be processed because the server is shutting down. |
| | | CancelRequest cancelRequest = new CancelRequest(true, reason); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Notify all the worker threads of the shutdown. |
| | | for (ParallelWorkerThread t : workerThreads) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this work queue has received a request to shut down. |
| | | * |
| | |
| | | return shutdownRequested; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Submits an operation to be processed by one of the worker threads |
| | | * associated with this work queue. |
| | |
| | | opsSubmitted.incrementAndGet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean trySubmitOperation(Operation operation) |
| | | throws DirectoryException |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Retrieves the next operation that should be processed by one of the worker |
| | | * threads, blocking if necessary until a new request arrives. This method |
| | |
| | | return retryNextOperation(workerThread, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the next operation that should be processed by one of the worker |
| | | * threads following a previous failure attempt. A maximum of five |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to remove the specified operation from this queue if it has not |
| | | * yet been picked up for processing by one of the worker threads. |
| | |
| | | return opQueue.remove(operation); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the total number of operations that have been successfully |
| | | * submitted to this work queue for processing since server startup. This |
| | |
| | | return opsSubmitted.longValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the number of pending operations in the queue that have not yet |
| | | * been picked up for processing. Note that this method is not a |
| | |
| | | return opQueue.size(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ParallelWorkQueueCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ParallelWorkQueueCfg configuration) |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isIdle() |
| | | { |
| | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | /** |
| | | * Provider for the password expiration time virtual attribute. |
| | | */ |
| | | /** Provider for the password expiration time virtual attribute. */ |
| | | public class PasswordExpirationTimeVirtualAttributeProvider |
| | | extends VirtualAttributeProvider<PasswordExpirationTimeVirtualAttributeCfg> |
| | | { |
| | | |
| | | /** |
| | | * Debug tracer to log debugging information. |
| | | */ |
| | | /** Debug tracer to log debugging information. */ |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public PasswordExpirationTimeVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.empty(rule.getAttributeType()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | searchOperation.appendErrorMessage(message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | } |
| | | |
| | | return pwpState.getPasswordExpirationTime(); |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** The enumerated value for the getPasswordPolicyDN operation. */ |
| | | public static final int OP_GET_PASSWORD_POLICY_DN = 0; |
| | | /** The enumerated value for the getAccountDisabledState operation. */ |
| | |
| | | public static final int OP_SET_ACCOUNT_EXPIRATION_TIME = 5; |
| | | /** The enumerated value for the clearAccountExpirationTime operation. */ |
| | | public static final int OP_CLEAR_ACCOUNT_EXPIRATION_TIME = 6; |
| | | /** |
| | | * The enumerated value for the getSecondsUntilAccountExpiration operation. |
| | | */ |
| | | /** The enumerated value for the getSecondsUntilAccountExpiration operation. */ |
| | | public static final int OP_GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION = 7; |
| | | /** The enumerated value for the getPasswordChangedTime operation. */ |
| | | public static final int OP_GET_PASSWORD_CHANGED_TIME = 8; |
| | |
| | | public static final int OP_GET_PASSWORD_EXPIRATION_WARNED_TIME = 11; |
| | | /** The enumerated value for the setPasswordExpirationWarnedTime operation. */ |
| | | public static final int OP_SET_PASSWORD_EXPIRATION_WARNED_TIME = 12; |
| | | /** |
| | | * The enumerated value for the clearPasswordExpirationWarnedTime operation. |
| | | */ |
| | | /** The enumerated value for the clearPasswordExpirationWarnedTime operation. */ |
| | | public static final int OP_CLEAR_PASSWORD_EXPIRATION_WARNED_TIME = 13; |
| | | /** |
| | | * The enumerated value for the getSecondsUntilPasswordExpiration operation. |
| | | */ |
| | | /** The enumerated value for the getSecondsUntilPasswordExpiration operation. */ |
| | | public static final int OP_GET_SECONDS_UNTIL_PASSWORD_EXPIRATION = 14; |
| | | /** |
| | | * The enumerated value for the getSecondsUntilPasswordExpirationWarning |
| | | * operation. |
| | | */ |
| | | /** The enumerated value for the getSecondsUntilPasswordExpirationWarning operation. */ |
| | | public static final int OP_GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING = 15; |
| | | /** The enumerated value for the getAuthenticationFailureTimes operation. */ |
| | | public static final int OP_GET_AUTHENTICATION_FAILURE_TIMES = 16; |
| | |
| | | public static final int OP_SET_AUTHENTICATION_FAILURE_TIMES = 18; |
| | | /** The enumerated value for the clearAuthenticationFailureTimes operation. */ |
| | | public static final int OP_CLEAR_AUTHENTICATION_FAILURE_TIMES = 19; |
| | | /** |
| | | * The enumerated value for the getSecondsUntilAuthenticationFailureUnlock |
| | | * operation. |
| | | */ |
| | | /** The enumerated value for the getSecondsUntilAuthenticationFailureUnlock operation. */ |
| | | public static final int OP_GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK = |
| | | 20; |
| | | /** |
| | | * The enumerated value for the getRemainingAuthenticationFailureCount |
| | | * operation. |
| | | */ |
| | | /** The enumerated value for the getRemainingAuthenticationFailureCount operation. */ |
| | | public static final int OP_GET_REMAINING_AUTHENTICATION_FAILURE_COUNT = 21; |
| | | /** The enumerated value for the getLastLoginTime operation. */ |
| | | public static final int OP_GET_LAST_LOGIN_TIME = 22; |
| | |
| | | public static final int OP_SET_PASSWORD_RESET_STATE = 27; |
| | | /** The enumerated value for the clearPasswordResetState operation. */ |
| | | public static final int OP_CLEAR_PASSWORD_RESET_STATE = 28; |
| | | /** |
| | | * The enumerated value for the getSecondsUntilPasswordResetLockout operation. |
| | | */ |
| | | /** The enumerated value for the getSecondsUntilPasswordResetLockout operation. */ |
| | | public static final int OP_GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT = 29; |
| | | /** The enumerated value for the getGraceLoginUseTimes operation. */ |
| | | public static final int OP_GET_GRACE_LOGIN_USE_TIMES = 30; |
| | |
| | | public static final int OP_CLEAR_GRACE_LOGIN_USE_TIMES = 33; |
| | | /** The enumerated value for the getRemainingGraceLoginCount operation. */ |
| | | public static final int OP_GET_REMAINING_GRACE_LOGIN_COUNT = 34; |
| | | /** |
| | | * The enumerated value for the getPasswordChangedByRequiredTime operation. |
| | | */ |
| | | /** The enumerated value for the getPasswordChangedByRequiredTime operation. */ |
| | | public static final int OP_GET_PASSWORD_CHANGED_BY_REQUIRED_TIME = 35; |
| | | /** |
| | | * The enumerated value for the setPasswordChangedByRequiredTime operation. |
| | | */ |
| | | /** The enumerated value for the setPasswordChangedByRequiredTime operation. */ |
| | | public static final int OP_SET_PASSWORD_CHANGED_BY_REQUIRED_TIME = 36; |
| | | /** |
| | | * The enumerated value for the clearPasswordChangedByRequiredTime operation. |
| | | */ |
| | | /** The enumerated value for the clearPasswordChangedByRequiredTime operation. */ |
| | | public static final int OP_CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME = 37; |
| | | /** |
| | | * The enumerated value for the getSecondsUntilRequiredChangeTime operation. |
| | | */ |
| | | /** The enumerated value for the getSecondsUntilRequiredChangeTime operation. */ |
| | | public static final int OP_GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME = 38; |
| | | /** The enumerated value for the getPasswordHistory operation. */ |
| | | public static final int OP_GET_PASSWORD_HISTORY = 39; |
| | | /** The enumerated value for the clearPasswordHistory operation. */ |
| | | public static final int OP_CLEAR_PASSWORD_HISTORY = 40; |
| | | |
| | | |
| | | /** The set of attributes to request when retrieving a user's entry. */ |
| | | private LinkedHashSet<String> requestAttributes; |
| | | |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes this extended operation handler based on the information in the |
| | | * provided configuration entry. It should also register itself with the |
| | |
| | | { |
| | | operation.setResultCode(ResultCode.UNDEFINED); |
| | | |
| | | |
| | | // The user must have the password-reset privilege in order to be able to do |
| | | // anything with this extended operation. |
| | | ClientConnection clientConnection = operation.getClientConnection(); |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // There must be a request value, and it must be a sequence. Decode it |
| | | // into its components. |
| | | ByteString requestValue = operation.getRequestValue(); |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Decode the DN and get the corresponding user entry. |
| | | DN targetDN; |
| | | try |
| | |
| | | } |
| | | reader.readEndSequence(); |
| | | |
| | | |
| | | // If there are any modifications that need to be made to the password |
| | | // policy state, then apply them now. |
| | | List<Modification> stateMods = pwpState.getModifications(); |
| | |
| | | userEntry, INFO_MODIFY_ACCOUNT_DISABLED.get(), |
| | | AccountStatusNotification.createProperties(pwpState, false, -1, |
| | | null, null)); |
| | | |
| | | } |
| | | if (isAccountSetEnabled) |
| | | { |
| | |
| | | writer.writeEndSequence(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Encodes the provided information in a form suitable for including in the |
| | | * response value. |
| | |
| | | { |
| | | secondsStr = |
| | | String.valueOf((policyRequiredChangeTime-currentTime) / 1000); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationOID() |
| | | { |
| | | return OID_PASSWORD_POLICY_STATE_EXTOP; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationName() |
| | | { |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Creates a new instance of this pwdPolicySubentry |
| | | * virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this pwdPolicySubentry virtual attribute provider. */ |
| | | public PasswordPolicySubentryVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.empty(rule.getAttributeType()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The identity mapper that will be used to map ID strings to user entries.*/ |
| | | /** The identity mapper that will be used to map ID strings to user entries. */ |
| | | private IdentityMapper<?> identityMapper; |
| | | |
| | | /** The current configuration for this SASL mechanism handler. */ |
| | | private PlainSASLMechanismHandlerCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this SASL mechanism handler. No initialization |
| | | * should be done in this method, as it should all be performed in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSASLMechanismHandler( |
| | | PlainSASLMechanismHandlerCfg configuration) |
| | |
| | | configuration.addPlainChangeListener(this); |
| | | currentConfig = configuration; |
| | | |
| | | |
| | | // Get the identity mapper that should be used to find users. |
| | | DN identityMapperDN = configuration.getIdentityMapperDN(); |
| | | identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN); |
| | | |
| | | |
| | | DirectoryServer.registerSASLMechanismHandler(SASL_MECHANISM_PLAIN, this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeSASLMechanismHandler() |
| | | { |
| | |
| | | DirectoryServer.deregisterSASLMechanismHandler(SASL_MECHANISM_PLAIN); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSASLBind(BindOperation bindOperation) |
| | | { |
| | |
| | | authzID = credString.substring(0, nullPos1); |
| | | } |
| | | |
| | | |
| | | int nullPos2 = credString.indexOf('\u0000', nullPos1+1); |
| | | if (nullPos2 < 0) |
| | | { |
| | |
| | | authcID = credString.substring(nullPos1+1, nullPos2); |
| | | password = credString.substring(nullPos2+1); |
| | | |
| | | |
| | | // Get the user entry for the authentication ID. Allow for an |
| | | // authentication ID that is just a username (as per the SASL PLAIN spec), |
| | | // but also allow a value in the authzid form specified in RFC 2829. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // At this point, we should have a user entry. If we don't then fail. |
| | | if (userEntry == null) |
| | | { |
| | |
| | | bindOperation.setSASLAuthUserEntry(userEntry); |
| | | } |
| | | |
| | | |
| | | // If an authorization ID was provided, then make sure that it is |
| | | // acceptable. |
| | | Entry authZEntry = userEntry; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Get the password policy for the user and use it to determine if the |
| | | // provided password was correct. |
| | | try |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then the authentication was successful. |
| | | bindOperation.setResultCode(ResultCode.SUCCESS); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isPasswordBased(String mechanism) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSecure(String mechanism) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | SASLMechanismHandlerCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | PlainSASLMechanismHandlerCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | PlainSASLMechanismHandlerCfg configuration) |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.RC4PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme that will |
| | | * encode values using the RC4 reversible encryption algorithm. This |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * The reference to the Directory Server crypto manager that we will use to |
| | | * handle the encryption/decryption. |
| | | */ |
| | | private CryptoManager cryptoManager; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | RC4PasswordStorageSchemeCfg configuration) |
| | |
| | | cryptoManager = DirectoryServer.getCryptoManager(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_RC4; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** The current configuration for this password validator. */ |
| | | private RandomPasswordGeneratorCfg currentConfig; |
| | | |
| | |
| | | /** The total length of the password that will be generated. */ |
| | | private int totalLength; |
| | | |
| | | /** |
| | | * The numbers of characters of each type that should be used to generate the |
| | | * passwords. |
| | | */ |
| | | /** The numbers of characters of each type that should be used to generate the passwords. */ |
| | | private int[] characterCounts; |
| | | |
| | | /** The character sets that should be used to generate the passwords. */ |
| | |
| | | /** The character set format string for this password generator. */ |
| | | private String formatString; |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordGenerator( |
| | | RandomPasswordGeneratorCfg configuration) |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordGenerator() |
| | | { |
| | | currentConfig.removeRandomChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates a password for the user whose account is contained in the |
| | | * specified entry. |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordGeneratorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | RandomPasswordGeneratorCfg configuration, |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | try |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then everything looks OK. |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RandomPasswordGeneratorCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the character sets for use in generating the password. At least one |
| | | // must have been provided. |
| | | SortedSet<String> newEncodedCharacterSets = null; |
| | |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | ArrayList<NamedCharacterSet> newSetList = new ArrayList<>(); |
| | |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // If everything looks OK, then apply the changes. |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.channels.ByteChannel; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class redirects read and write requests either to a child byte channel, |
| | | * or a byte channel to be redirected to. |
| | |
| | | return new RedirectingByteChannel(bc); |
| | | } |
| | | |
| | | |
| | | |
| | | private final ByteChannel child; |
| | | private volatile ByteChannel redirect; |
| | | |
| | | |
| | | |
| | | private RedirectingByteChannel(final ByteChannel child) |
| | | { |
| | | this.child = child; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() throws IOException |
| | | { |
| | | final ByteChannel tmp = redirect; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Disable redirection. |
| | | */ |
| | | /** Disable redirection. */ |
| | | public final void disable() |
| | | { |
| | | redirect = null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isOpen() |
| | | { |
| | | final ByteChannel tmp = redirect; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int read(final ByteBuffer buffer) throws IOException |
| | | { |
| | | final ByteChannel tmp = redirect; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Redirects a byte channel to a byte channel associated with the specified |
| | | * provider. |
| | |
| | | redirect = provider.getChannel(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int write(final ByteBuffer buffer) throws IOException |
| | | { |
| | | final ByteChannel tmp = redirect; |
| | |
| | | /** The replacement string to use for the pattern. */ |
| | | private String replacePattern; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this regular expression identity mapper. All |
| | | * initialization should be performed in the {@code initializeIdentityMapper} |
| | |
| | | // Don't do any initialization here. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeIdentityMapper( |
| | | RegularExpressionIdentityMapperCfg configuration) |
| | |
| | | replacePattern = ""; |
| | | } |
| | | |
| | | |
| | | // Get the attribute types to use for the searches. Ensure that they are |
| | | // all indexed for equality. |
| | | attributeTypes = |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = newLinkedHashSet("*", "+"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeIdentityMapper() |
| | | { |
| | | currentConfig.removeRegularExpressionChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntryForID(String id) |
| | | throws DirectoryException |
| | |
| | | RegularExpressionIdentityMapperCfg config = currentConfig; |
| | | AttributeType[] attributeTypes = this.attributeTypes; |
| | | |
| | | |
| | | // Run the provided identifier string through the regular expression pattern |
| | | // matcher and make the appropriate replacement. |
| | | Matcher matcher = matchPattern.matcher(id); |
| | | String processedID = matcher.replaceAll(replacePattern); |
| | | |
| | | |
| | | // Construct the search filter to use to make the determination. |
| | | SearchFilter filter; |
| | | if (attributeTypes.length == 1) |
| | |
| | | filter = SearchFilter.createORFilter(filterComps); |
| | | } |
| | | |
| | | |
| | | // Iterate through the set of search bases and process an internal search |
| | | // to find any matching entries. Since we'll only allow a single match, |
| | | // then use size and time limits to constrain costly searches resulting from |
| | |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | |
| | | |
| | | case TIME_LIMIT_EXCEEDED: |
| | | case ADMIN_LIMIT_EXCEEDED: |
| | | // The search criteria was too inefficient. |
| | |
| | | return matchingEntry; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(IdentityMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | RegularExpressionIdentityMapperCfg configuration, |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RegularExpressionIdentityMapperCfg configuration) |
| | |
| | | newReplacePattern = ""; |
| | | } |
| | | |
| | | |
| | | AttributeType[] newAttributeTypes = |
| | | configuration.getMatchAttribute().toArray(new AttributeType[0]); |
| | | |
| | | |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | attributeTypes = newAttributeTypes; |
| | |
| | | /** The current configuration for this password validator. */ |
| | | private RepeatedCharactersPasswordValidatorCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this repeated characters password validator. |
| | | */ |
| | | /** Creates a new instance of this repeated characters password validator. */ |
| | | public RepeatedCharactersPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | RepeatedCharactersPasswordValidatorCfg configuration) |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeRepeatedCharactersChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | // Get the password as a string. If we should use case-insensitive |
| | | // validation, then convert it to use all lowercase characters. |
| | | String passwordString = newPassword.toString(); |
| | |
| | | passwordString = passwordString.toLowerCase(); |
| | | } |
| | | |
| | | |
| | | // Create variables to keep track of the last character we've seen and how |
| | | // many times we have seen it. |
| | | char lastCharacter = '\u0000'; |
| | | int consecutiveCount = 0; |
| | | |
| | | |
| | | // Iterate through the characters in the password. If the consecutive |
| | | // count ever gets too high, then fail. |
| | | for (int i=0; i < passwordString.length(); i++) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | RepeatedCharactersPasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RepeatedCharactersPasswordValidatorCfg configuration) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | */ |
| | | public final class SASLByteChannel implements ConnectionSecurityProvider |
| | | { |
| | | |
| | | /** Private implementation. */ |
| | | private final class ByteChannelImpl implements ByteChannel |
| | | { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() throws IOException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isOpen() |
| | | { |
| | | return saslContext != null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int read(final ByteBuffer unwrappedData) throws IOException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int write(final ByteBuffer unwrappedData) throws IOException |
| | | { |
| | |
| | | return bytesWritten; |
| | | } |
| | | |
| | | |
| | | |
| | | /** Attempt to read and unwrap the next SASL packet. */ |
| | | private int doRecvAndUnwrap() throws IOException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Return a SASL byte channel instance created using the specified parameters. |
| | | * |
| | |
| | | return new SASLByteChannel(c, name, context); |
| | | } |
| | | |
| | | |
| | | |
| | | private final String name; |
| | | private final ByteChannel channel; |
| | | private final ByteChannelImpl pimpl = new ByteChannelImpl(); |
| | |
| | | private final Object readLock = new Object(); |
| | | private final Object writeLock = new Object(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Create a SASL byte channel with the specified parameters that is capable of |
| | | * processing a confidentiality/integrity SASL connection. |
| | |
| | | sendWrappedBuffer = ByteBuffer.allocate(sendUnwrappedBufferSize + 64); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteChannel getChannel() |
| | | { |
| | | return pimpl; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Certificate[] getClientCertificateChain() |
| | | { |
| | | return new Certificate[0]; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getSSF() |
| | | { |
| | | return saslContext.getSSF(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSecure() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * SHA-1 algorithm defined in FIPS 180-1. This is a one-way digest algorithm |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.SHA1PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** The message digest that will actually be used to generate the SHA-1 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | | /** The lock used to provide threadsafe access to the message digest. */ |
| | | private Object digestLock; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | SHA1PasswordStorageSchemeCfg configuration) |
| | |
| | | digestLock = new Object(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_SHA_1; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(digestBytes)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return userPWDigestBytes.equals(storedPWDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** A mapping between the notification types and the message template. */ |
| | | private HashMap<AccountStatusNotificationType, |
| | | List<NotificationMessageTemplateElement>> templateMap; |
| | |
| | | /** The current configuration for this account status notification handler. */ |
| | | private SMTPAccountStatusNotificationHandlerCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new, uninitialized instance of this account status notification |
| | | * handler. |
| | | */ |
| | | /** Creates a new, uninitialized instance of this account status notification handler. */ |
| | | public SMTPAccountStatusNotificationHandler() |
| | | { |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeStatusNotificationHandler( |
| | | SMTPAccountStatusNotificationHandlerCfg configuration) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Examines the provided configuration and parses the message subject |
| | | * information from it. |
| | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Examines the provided configuration and parses the message template |
| | | * information from it. |
| | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Parses the specified template file into a list of notification message |
| | | * template elements. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // We need to put a CRLF at the end of the line, as per the SMTP spec. |
| | | elementList.add(new TextNotificationMessageTemplateElement("\r\n")); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | AccountStatusNotificationHandlerCfg |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleStatusNotification(AccountStatusNotification notification) |
| | | { |
| | |
| | | HashMap<AccountStatusNotificationType, |
| | | List<NotificationMessageTemplateElement>> templates = templateMap; |
| | | |
| | | |
| | | // First, see if the notification type is one that we handle. If not, then |
| | | // return without doing anything. |
| | | AccountStatusNotificationType notificationType = |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // It is a notification that should be handled, so we can start generating |
| | | // the e-mail message. First, check to see if there are any mail attributes |
| | | // that would cause us to send a message to the end user. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Next, add any explicitly-defined recipients. |
| | | if (recipientAddrs != null) |
| | | { |
| | |
| | | recipients.addAll(recipientAddrs); |
| | | } |
| | | |
| | | |
| | | // Get the message subject to use. If none is defined, then use a generic |
| | | // subject. |
| | | String subject = subjects.get(notificationType); |
| | |
| | | logger.trace("Using per-type subject of " + subject); |
| | | } |
| | | |
| | | |
| | | |
| | | // Generate the message body. |
| | | LocalizableMessageBuilder messageBody = new LocalizableMessageBuilder(); |
| | | for (NotificationMessageTemplateElement e : templateElements) |
| | |
| | | e.generateValue(messageBody, notification); |
| | | } |
| | | |
| | | |
| | | // Create and send the e-mail message. |
| | | EMailMessage message = new EMailMessage(config.getSenderAddress(), |
| | | recipients, subject); |
| | |
| | | logger.trace("Set message body of " + messageBody); |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | message.send(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SMTPAccountStatusNotificationHandlerCfg configuration, |
| | |
| | | { |
| | | boolean configAcceptable = true; |
| | | |
| | | |
| | | // Make sure that the Directory Server is configured with information about |
| | | // one or more mail servers. |
| | | List<Properties> propList = DirectoryServer.getMailServerPropertySets(); |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // Make sure that either an explicit recipient list or a set of email |
| | | // address attributes were provided. |
| | | Set<AttributeType> mailAttrs = configuration.getEmailAddressAttributeType(); |
| | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SMTPAccountStatusNotificationHandlerCfg configuration) |
| | |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.EMailMessage; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class implements a Directory Server alert handler that may be used to |
| | | * send administrative alerts via SMTP. |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** The current configuration for this alert handler. */ |
| | | private SMTPAlertHandlerCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this SMTP alert handler. |
| | | */ |
| | | /** Creates a new instance of this SMTP alert handler. */ |
| | | public SMTPAlertHandler() |
| | | { |
| | | super(); |
| | |
| | | // All initialization should be done in the initializeAlertHandler method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeAlertHandler(SMTPAlertHandlerCfg configuration) |
| | | throws ConfigException, InitializationException |
| | | { |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AlertHandlerCfg getAlertHandlerConfiguration() |
| | | { |
| | | return currentConfig; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(AlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeAlertHandler() |
| | | { |
| | | // No action is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void sendAlertNotification(AlertGenerator generator, String alertType, |
| | | LocalizableMessage alertMessage) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Replaces any occurrences of special tokens in the given string with the |
| | | * appropriate value. Tokens supported include: |
| | |
| | | replace("\\n", "\r\n"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SMTPAlertHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SMTPAlertHandlerCfg configuration) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * MD5 algorithm defined in RFC 1321. This is a one-way digest algorithm so |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.SaltedMD5PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The number of bytes of random data to use as the salt when generating the |
| | | * hashes. |
| | | */ |
| | | /** The number of bytes of random data to use as the salt when generating the hashes. */ |
| | | private static final int NUM_SALT_BYTES = 8; |
| | | |
| | | /** The number of bytes MD5 algorithm produces. */ |
| | | private static final int MD5_LENGTH = 16; |
| | | |
| | | |
| | | /** The message digest that will actually be used to generate the MD5 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | |
| | | /** The secure random number generator to use to generate the salt values. */ |
| | | private Random random; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | SaltedMD5PasswordStorageSchemeCfg configuration) |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | digestLock = new Object(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_SALTED_MD5; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Use the salt to generate a digest based on the provided plain-text value. |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSalt = new byte[plainBytesLength + saltLength]; |
| | |
| | | return Arrays.equals(digestBytes, userDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_SALTED_MD5; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Encode and return the value. |
| | | StringBuilder authPWValue = new StringBuilder(); |
| | | authPWValue.append(AUTH_PASSWORD_SCHEME_NAME_SALTED_MD5); |
| | |
| | | return ByteString.valueOfUtf8(authPWValue); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSaltBytes = new byte[plainBytesLength + saltBytes.length]; |
| | | plaintextPassword.copyTo(plainPlusSaltBytes); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * SHA-1 algorithm defined in FIPS 180-1. This is a one-way digest algorithm |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.SaltedSHA1PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The number of bytes of random data to use as the salt when generating the |
| | | * hashes. |
| | | */ |
| | | /** The number of bytes of random data to use as the salt when generating the hashes. */ |
| | | private static final int NUM_SALT_BYTES = 8; |
| | | |
| | | /** The number of bytes SHA algorithm produces. */ |
| | | private static final int SHA1_LENGTH = 20; |
| | | |
| | | |
| | | /** The message digest that will actually be used to generate the SHA-1 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | |
| | | /** The secure random number generator to use to generate the salt values. */ |
| | | private Random random; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | SaltedSHA1PasswordStorageSchemeCfg configuration) |
| | |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_SALTED_SHA_1; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Use the salt to generate a digest based on the provided plain-text value. |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSalt = new byte[plainBytesLength + saltLength]; |
| | |
| | | return Arrays.equals(digestBytes, userDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_1; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Encode and return the value. |
| | | StringBuilder authPWValue = new StringBuilder(); |
| | | authPWValue.append(AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_1); |
| | |
| | | return ByteString.valueOfUtf8(authPWValue); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSaltBytes = new byte[plainBytesLength + saltBytes.length]; |
| | | plaintextPassword.copyTo(plainPlusSaltBytes); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates an encoded password string from the given clear-text password. |
| | | * This method is primarily intended for use when it is necessary to generate |
| | |
| | | throw new DirectoryException(ResultCode.OTHER, message, e); |
| | | } |
| | | |
| | | |
| | | byte[] digestBytes = messageDigest.digest(passwordPlusSalt); |
| | | byte[] digestPlusSalt = new byte[digestBytes.length + NUM_SALT_BYTES]; |
| | | System.arraycopy(digestBytes, 0, digestPlusSalt, 0, digestBytes.length); |
| | |
| | | Base64.encode(digestPlusSalt); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * 256-bit SHA-2 algorithm defined in FIPS 180-2. This is a one-way digest |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.SaltedSHA256PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The number of bytes of random data to use as the salt when generating the |
| | | * hashes. |
| | | */ |
| | | /** The number of bytes of random data to use as the salt when generating the hashes. */ |
| | | private static final int NUM_SALT_BYTES = 8; |
| | | |
| | | /** Size of the dgiest in bytes. */ |
| | | private static final int SHA256_LENGTH = 256 / 8; |
| | | |
| | | /** |
| | | * The message digest that will actually be used to generate the 256-bit SHA-2 |
| | | * hashes. |
| | | */ |
| | | /** The message digest that will actually be used to generate the 256-bit SHA-2 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | | /** The lock used to provide threadsafe access to the message digest. */ |
| | |
| | | /** The secure random number generator to use to generate the salt values. */ |
| | | private Random random; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | SaltedSHA256PasswordStorageSchemeCfg configuration) |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | digestLock = new Object(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_SALTED_SHA_256; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Use the salt to generate a digest based on the provided plain-text value. |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSalt = new byte[plainBytesLength + saltLength]; |
| | |
| | | return Arrays.equals(digestBytes, userDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_256; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Encode and return the value. |
| | | StringBuilder authPWValue = new StringBuilder(); |
| | | authPWValue.append(AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_256); |
| | |
| | | return ByteString.valueOfUtf8(authPWValue); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSaltBytes = new byte[plainBytesLength + saltBytes.length]; |
| | | plaintextPassword.copyTo(plainPlusSaltBytes); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * 384-bit SHA-2 algorithm defined in FIPS 180-2. This is a one-way digest |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.SaltedSHA384PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The number of bytes of random data to use as the salt when generating the |
| | | * hashes. |
| | | */ |
| | | /** The number of bytes of random data to use as the salt when generating the hashes. */ |
| | | private static final int NUM_SALT_BYTES = 8; |
| | | |
| | | |
| | | /** The size of the digest in bytes. */ |
| | | private static final int SHA384_LENGTH = 384 / 8; |
| | | |
| | | /** |
| | | * The message digest that will actually be used to generate the 384-bit SHA-2 |
| | | * hashes. |
| | | */ |
| | | /** The message digest that will actually be used to generate the 384-bit SHA-2 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | | /** The lock used to provide threadsafe access to the message digest. */ |
| | |
| | | /** The secure random number generator to use to generate the salt values. */ |
| | | private Random random; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | SaltedSHA384PasswordStorageSchemeCfg configuration) |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | digestLock = new Object(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_SALTED_SHA_384; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Use the salt to generate a digest based on the provided plain-text value. |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSalt = new byte[plainBytesLength + saltLength]; |
| | |
| | | return Arrays.equals(digestBytes, userDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_384; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Encode and return the value. |
| | | StringBuilder authPWValue = new StringBuilder(); |
| | | authPWValue.append(AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_384); |
| | |
| | | return ByteString.valueOfUtf8(authPWValue); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSaltBytes = new byte[plainBytesLength + saltBytes.length]; |
| | | plaintextPassword.copyTo(plainPlusSaltBytes); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme based on the |
| | | * 512-bit SHA-2 algorithm defined in FIPS 180-2. This is a one-way digest |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.SaltedSHA512PasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The number of bytes of random data to use as the salt when generating the |
| | | * hashes. |
| | | */ |
| | | /** The number of bytes of random data to use as the salt when generating the hashes. */ |
| | | private static final int NUM_SALT_BYTES = 8; |
| | | |
| | | |
| | | /** The size of the digest in bytes. */ |
| | | private static final int SHA512_LENGTH = 512 / 8; |
| | | |
| | | /** |
| | | * The message digest that will actually be used to generate the 512-bit SHA-2 |
| | | * hashes. |
| | | */ |
| | | /** The message digest that will actually be used to generate the 512-bit SHA-2 hashes. */ |
| | | private MessageDigest messageDigest; |
| | | |
| | | /** The lock used to provide threadsafe access to the message digest. */ |
| | |
| | | /** The secure random number generator to use to generate the salt values. */ |
| | | private Random random; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | SaltedSHA512PasswordStorageSchemeCfg configuration) |
| | |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_SALTED_SHA_512; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Use the salt to generate a digest based on the provided plain-text value. |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSalt = new byte[plainBytesLength + saltLength]; |
| | |
| | | return Arrays.equals(digestBytes, userDigestBytes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAuthPasswordSchemeName() |
| | | { |
| | | return AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_512; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Encode and return the value. |
| | | StringBuilder authPWValue = new StringBuilder(); |
| | | authPWValue.append(AUTH_PASSWORD_SCHEME_NAME_SALTED_SHA_512); |
| | |
| | | return ByteString.valueOfUtf8(authPWValue); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | int plainBytesLength = plaintextPassword.length(); |
| | | byte[] plainPlusSaltBytes = new byte[plainBytesLength + saltBytes.length]; |
| | | plaintextPassword.copyTo(plainPlusSaltBytes); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates an encoded password string from the given clear-text password. |
| | | * This method is primarily intended for use when it is necessary to generate |
| | |
| | | throw new DirectoryException(ResultCode.OTHER, message, e); |
| | | } |
| | | |
| | | |
| | | byte[] digestBytes = messageDigest.digest(passwordPlusSalt); |
| | | byte[] digestPlusSalt = new byte[digestBytes.length + NUM_SALT_BYTES]; |
| | | System.arraycopy(digestBytes, 0, digestPlusSalt, 0, digestBytes.length); |
| | |
| | | Base64.encode(digestPlusSalt); |
| | | } |
| | | } |
| | | |
| | |
| | | PasswordValidator<SimilarityBasedPasswordValidatorCfg> implements |
| | | ConfigurationChangeListener<SimilarityBasedPasswordValidatorCfg> |
| | | { |
| | | |
| | | /** The current configuration for this password validator. */ |
| | | private SimilarityBasedPasswordValidatorCfg currentConfig; |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password validator. |
| | | */ |
| | | /** Creates a new instance of this password validator. */ |
| | | public SimilarityBasedPasswordValidator() |
| | | { |
| | | super(); |
| | | |
| | | |
| | | // All initialization must be done in the initializePasswordValidator |
| | | // method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | SimilarityBasedPasswordValidatorCfg configuration) |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeSimilarityBasedChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | | Operation operation, Entry userEntry, |
| | | LocalizableMessageBuilder invalidReason) { |
| | | |
| | | int minDifference = currentConfig.getMinPasswordDifference(); |
| | | ByteString passwd = newPassword == null |
| | | ? ByteString.empty() |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SimilarityBasedPasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SimilarityBasedPasswordValidatorCfg configuration) |
| | | { |
| | |
| | | package org.opends.server.extensions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | |
| | | import java.util.Iterator; |
| | |
| | | import static org.opends.server.extensions.StaticGroup.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of the {@code MemberList} class that |
| | | * may be used in conjunction when static groups when no additional criteria is |
| | |
| | | this.memberDNIterator = memberDNs.iterator(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasMoreMembers() |
| | | { |
| | | return memberDNIterator.hasNext(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN nextMemberDN() |
| | | throws MembershipException |
| | |
| | | return dn; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry nextMemberEntry() throws MembershipException |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | } |
| | | |
| | |
| | | /** The mapping between backend+ID and their corresponding entries. */ |
| | | private ConcurrentMap<String, ConcurrentMap<Long, Reference<CacheEntry>>> idMap; |
| | | |
| | | /** |
| | | * The reference queue that will be used to notify us whenever a soft |
| | | * reference is freed. |
| | | */ |
| | | /** The reference queue that will be used to notify us whenever a soft reference is freed. */ |
| | | private ReferenceQueue<CacheEntry> referenceQueue; |
| | | |
| | | /** Currently registered configuration object. */ |
| | |
| | | private Thread cleanerThread; |
| | | private volatile boolean shutdown; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this soft reference entry cache. All |
| | | * initialization should be performed in the <CODE>initializeEntryCache</CODE> |
| | |
| | | referenceQueue = new ReferenceQueue<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeEntryCache( |
| | | SoftReferenceEntryCacheCfg configuration |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public synchronized void finalizeEntryCache() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsEntry(DN entryDN) |
| | | { |
| | | return entryDN != null && dnMap.containsKey(entryDN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(DN entryDN) |
| | | { |
| | |
| | | return cacheEntry.getEntry(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getEntryID(DN entryDN) |
| | | { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getEntryDN(String backendID, long entryID) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void putEntry(Entry entry, String backendID, long entryID) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean putEntryIfAbsent(Entry entry, String backendID, long entryID) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Create the cache entry based on the provided information. |
| | | CacheEntry cacheEntry = new CacheEntry(entry, backendID, entryID); |
| | | Reference<CacheEntry> ref = new SoftReference<>(cacheEntry, referenceQueue); |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeEntry(DN entryDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clear() |
| | | { |
| | |
| | | idMap.clear(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearBackend(String backendID) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearSubtree(DN baseDN) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void handleLowMemory() |
| | | { |
| | |
| | | // FIXME -- Do we need to do anything at all here? |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(EntryCacheCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SoftReferenceEntryCacheCfg configuration, |
| | |
| | | return errorHandler.getIsAcceptable(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(SoftReferenceEntryCacheCfg configuration) |
| | | { |
| | |
| | | return changeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Parses the provided configuration and configure the entry cache. |
| | | * |
| | |
| | | return Long.valueOf(dnMap.size()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toVerboseString() |
| | | { |
| | |
| | | public class StartTLSExtendedOperation |
| | | extends ExtendedOperationHandler<StartTLSExtendedOperationHandlerCfg> |
| | | { |
| | | |
| | | /** |
| | | * Create an instance of this StartTLS extended operation handler. All |
| | | * initialization should be performed in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeExtendedOperationHandler( |
| | | StartTLSExtendedOperationHandlerCfg config) |
| | |
| | | // happen. |
| | | operation.setResponseOID(OID_START_TLS_REQUEST); |
| | | |
| | | |
| | | // Get the reference to the client connection. If there is none, then fail. |
| | | ClientConnection clientConnection = operation.getClientConnection(); |
| | | if (clientConnection == null) |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Make sure that the client connection is capable of enabling TLS. If not, |
| | | // then fail. |
| | | TLSCapableConnection tlsCapableConnection; |
| | |
| | | operation.setResultCode(ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationOID() |
| | | { |
| | | return OID_START_TLS_REQUEST; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationName() |
| | | { |
| | |
| | | this.memberDNs = memberDNs; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeGroupImplementation(StaticGroupImplementationCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | // No additional initialization is required. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public StaticGroup newInstance(ServerContext serverContext, Entry groupEntry) throws DirectoryException |
| | | { |
| | |
| | | return new StaticGroup(serverContext, groupEntry.getName(), someMemberAttributeType, someMemberDNs); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SearchFilter getGroupDefinitionFilter() |
| | | throws DirectoryException |
| | |
| | | return SearchFilter.createFilterFromString(filterString); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isGroupDefinition(Entry entry) |
| | | { |
| | |
| | | return entry.hasObjectClass(DirectoryConfig.getObjectClass(ocName, true)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getGroupDN() |
| | | { |
| | | return groupEntryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setGroupDN(DN groupDN) |
| | | { |
| | | groupEntryDN = groupDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsNestedGroups() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<DN> getNestedGroupDNs() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMember(DN userDN, Set<DN> examinedGroups) throws DirectoryException |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMember(Entry userEntry, Set<DN> examinedGroups) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MemberList getMembers() throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MemberList getMembers(DN baseDN, SearchScope scope, SearchFilter filter) throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mayAlterMemberList() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateMembers(List<Modification> modifications) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addMember(Entry userEntry) throws UnsupportedOperationException, DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeMember(DN userDN) throws UnsupportedOperationException, DirectoryException |
| | | { |
| | |
| | | newLinkedList(control), groupEntryDN, mods); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | return compactDn.toDn(); |
| | | } |
| | | } |
| | | |
| | |
| | | public class StructuralObjectClassVirtualAttributeProvider |
| | | extends VirtualAttributeProvider<StructuralObjectClassVirtualAttributeCfg> |
| | | { |
| | | /** |
| | | * Creates a new instance of this structuralObjectClass virtual attribute |
| | | * provider. |
| | | */ |
| | | /** Creates a new instance of this structuralObjectClass virtual attribute provider. */ |
| | | public StructuralObjectClassVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | .getStructuralObjectClass().getNameOrOID()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | return entry.getStructuralObjectClass() != null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | searchOperation.appendErrorMessage(message); |
| | | } |
| | | } |
| | | |
| | |
| | | /** The set of attributes to return in search result entries. */ |
| | | private LinkedHashSet<String> requestedAttributes; |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this certificate mapper. Note that all actual |
| | | * initialization should be done in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeCertificateMapper( |
| | | SubjectDNToUserAttributeCertificateMapperCfg |
| | |
| | | currentConfig = configuration; |
| | | configEntryDN = configuration.dn(); |
| | | |
| | | |
| | | // Make sure that the subject attribute is configured for equality in all |
| | | // appropriate backends. |
| | | Set<DN> cfgBaseDNs = configuration.getUserBaseDN(); |
| | |
| | | requestedAttributes = newLinkedHashSet("*", "+"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeCertificateMapper() |
| | | { |
| | | currentConfig.removeSubjectDNToUserAttributeChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry mapCertificateToUser(Certificate[] certificateChain) |
| | | throws DirectoryException |
| | |
| | | currentConfig; |
| | | AttributeType subjectAttributeType = config.getSubjectAttribute(); |
| | | |
| | | |
| | | // Make sure that a peer certificate was provided. |
| | | if (certificateChain == null || certificateChain.length == 0) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the first certificate in the chain. It must be an X.509 certificate. |
| | | X509Certificate peerCertificate; |
| | | try |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the subject from the peer certificate and use it to create a search |
| | | // filter. |
| | | X500Principal peerPrincipal = peerCertificate.getSubjectX500Principal(); |
| | |
| | | SearchFilter filter = SearchFilter.createEqualityFilter( |
| | | subjectAttributeType, ByteString.valueOfUtf8(peerName)); |
| | | |
| | | |
| | | // If we have an explicit set of base DNs, then use it. Otherwise, use the |
| | | // set of public naming contexts in the server. |
| | | Collection<DN> baseDNs = config.getUserBaseDN(); |
| | |
| | | baseDNs = DirectoryServer.getPublicNamingContexts().keySet(); |
| | | } |
| | | |
| | | |
| | | // For each base DN, issue an internal search in an attempt to map the |
| | | // certificate. |
| | | Entry userEntry = null; |
| | |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_CREDENTIALS, message); |
| | | |
| | | |
| | | case TIME_LIMIT_EXCEEDED: |
| | | case ADMIN_LIMIT_EXCEEDED: |
| | | // The search criteria was too inefficient. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then we either found exactly one user entry or we |
| | | // didn't find any. Either way, return the entry or null to the caller. |
| | | return userEntry; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(CertificateMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SubjectDNToUserAttributeCertificateMapperCfg |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SubjectDNToUserAttributeCertificateMapperCfg |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.security.cert.Certificate; |
| | | import java.security.cert.X509Certificate; |
| | | import javax.security.auth.x500.X500Principal; |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeCertificateMapper(SubjectEqualsDNCertificateMapperCfg |
| | | configuration) |
| | |
| | | // No initialization is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Establishes a mapping between the information in the provided certificate |
| | | * chain to the DN of a single user in the Directory Server. |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the first certificate in the chain. It must be an X.509 certificate. |
| | | X509Certificate peerCertificate; |
| | | try |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the subject from the peer certificate and decode it as a DN. |
| | | X500Principal peerPrincipal = peerCertificate.getSubjectX500Principal(); |
| | | DN subjectDN; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | public class SubschemaSubentryVirtualAttributeProvider |
| | | extends VirtualAttributeProvider<SubschemaSubentryVirtualAttributeCfg> |
| | | { |
| | | /** |
| | | * Creates a new instance of this subschemaSubentry virtual attribute |
| | | * provider. |
| | | */ |
| | | /** Creates a new instance of this subschemaSubentry virtual attribute provider. */ |
| | | public SubschemaSubentryVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | return Attributes.create(rule.getAttributeType(), schemaDN.toString()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult matchesSubstring(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult lessThanOrEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult approximatelyEqualTo(Entry entry, |
| | | VirtualAttributeRule rule, |
| | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | searchOperation.appendErrorMessage(message); |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.channels.ByteChannel; |
| | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A class that provides a TLS byte channel implementation. |
| | | */ |
| | | /** A class that provides a TLS byte channel implementation. */ |
| | | public final class TLSByteChannel implements ConnectionSecurityProvider |
| | | { |
| | | /** |
| | | * Private implementation. |
| | | */ |
| | | /** Private implementation. */ |
| | | private final class ByteChannelImpl implements ByteChannel |
| | | { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() throws IOException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isOpen() |
| | | { |
| | | return !sslEngine.isOutboundDone() || !sslEngine.isInboundDone(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int read(final ByteBuffer unwrappedData) throws IOException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int write(final ByteBuffer unwrappedData) throws IOException |
| | | { |
| | |
| | | return bytesWritten; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * It seems that the SSL engine does not remember if an error has already |
| | | * occurred so we must cache it here and rethrow. See OPENDJ-652. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void doHandshake(final boolean isReading) throws IOException |
| | | { |
| | | // This lock is probably unnecessary since tasks can be run in parallel, |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** Attempt to read and unwrap the next SSL packet. */ |
| | | private int doRecvAndUnwrap() throws IOException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** Attempt to wrap and send the next SSL packet. */ |
| | | private int doWrapAndSend(final ByteBuffer unwrappedData) |
| | | throws IOException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private boolean isHandshaking(final HandshakeStatus status) |
| | | { |
| | | return status != HandshakeStatus.NOT_HANDSHAKING; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Map of cipher phrases to effective key size (bits). Taken from the |
| | | * following RFCs: 5289, 4346, 3268,4132 and 4162 and the IANA Transport Layer |
| | |
| | | private final Object readLock = new Object(); |
| | | private final Object writeLock = new Object(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates an TLS byte channel instance using the specified LDAP connection |
| | | * configuration, client connection, SSL context and socket channel |
| | |
| | | recvUnwrappedBuffer.flip(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteChannel getChannel() |
| | | { |
| | | return pimpl; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Certificate[] getClientCertificateChain() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getName() |
| | | { |
| | | return "TLS"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getSSF() |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSecure() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.opends.server.types.AccountStatusNotification; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class implements a notification message template element that will |
| | | * generate a value using static text. |
| | |
| | | /** The static text associated with this element. */ |
| | | private final String text; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new text notification message template element from the provided |
| | | * string. |
| | |
| | | this.text = text; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void generateValue(LocalizableMessageBuilder buffer, |
| | | AccountStatusNotification notification) |
| | | { |
| | | buffer.append(text); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | |
| | |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Operation; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a data structure for storing and interacting with the |
| | | * Directory Server work queue. |
| | |
| | | /** The queue that will be used to actually hold the pending operations. */ |
| | | private LinkedBlockingQueue<Operation> opQueue; |
| | | |
| | | /** |
| | | * The lock used to provide threadsafe access for the queue, used for |
| | | * non-config changes. |
| | | */ |
| | | /** The lock used to provide threadsafe access for the queue, used for non-config changes. */ |
| | | private final ReadLock queueReadLock; |
| | | |
| | | /** |
| | | * The lock used to provide threadsafe access for the queue, used for config |
| | | * changes. |
| | | */ |
| | | /** The lock used to provide threadsafe access for the queue, used for config changes. */ |
| | | private final WriteLock queueWriteLock; |
| | | { |
| | | ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
| | |
| | | queueWriteLock = lock.writeLock(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this work queue. All initialization should be |
| | | * performed in the <CODE>initializeWorkQueue</CODE> method. |
| | |
| | | // No implementation should be performed here. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeWorkQueue(TraditionalWorkQueueCfg configuration) |
| | | throws ConfigException, InitializationException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeWorkQueue(LocalizableMessage reason) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this work queue has received a request to shut down. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Submits an operation to be processed by one of the worker threads |
| | | * associated with this work queue. |
| | |
| | | submitOperation(operation, isBlocking); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean trySubmitOperation(Operation operation) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the next operation that should be processed by one of the worker |
| | | * threads, blocking if necessary until a new request arrives. This method |
| | |
| | | return retryNextOperation(workerThread, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the next operation that should be processed by one of the worker |
| | | * threads following a previous failure attempt. A maximum of five consecutive |
| | |
| | | return retryNextOperation(workerThread, numFailures + 1); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Kills this worker thread if needed. This method assumes that the read lock |
| | | * is already taken and ensure that it is taken on exit. |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the total number of operations that have been successfully |
| | | * submitted to this work queue for processing since server startup. This does |
| | |
| | | return opsSubmitted.longValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the total number of operations that have been rejected because |
| | | * the work queue was already at its maximum capacity. |
| | |
| | | return queueFullRejects.longValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the number of pending operations in the queue that have not yet |
| | | * been picked up for processing. Note that this method is not a constant-time |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | TraditionalWorkQueueCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TraditionalWorkQueueCfg configuration) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // Apply a change to the maximum capacity if appropriate. Since we can't |
| | | // change capacity on the fly, then we'll have to create a new queue and |
| | | // transfer any remaining items into it. Any thread that is waiting on the |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isIdle() |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.server.TripleDESPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server password storage scheme that will |
| | | * encode values using the triple-DES (DES/EDE) reversible encryption algorithm. |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * The reference to the Directory Server crypto manager that we will use to |
| | | * handle the encryption/decryption. |
| | | */ |
| | | private CryptoManager cryptoManager; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | TripleDESPasswordStorageSchemeCfg configuration) |
| | |
| | | cryptoManager = DirectoryServer.getCryptoManager(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_3DES; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | /** The current configuration for this password validator. */ |
| | | private UniqueCharactersPasswordValidatorCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this unique characters password validator. |
| | | */ |
| | | /** Creates a new instance of this unique characters password validator. */ |
| | | public UniqueCharactersPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | UniqueCharactersPasswordValidatorCfg configuration) |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeUniqueCharactersChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | // Create a set that will be used to keep track of the unique characters |
| | | // contained in the proposed password. |
| | | HashSet<Character> passwordCharacters = new HashSet<>(); |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | UniqueCharactersPasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | UniqueCharactersPasswordValidatorCfg configuration) |
| | | { |
| | |
| | | return ccr; |
| | | } |
| | | } |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.opends.server.types.AccountStatusNotification; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class implements a notification message template element that will |
| | | * generate a value that is the string representation of the target user's DN. |
| | |
| | | public class UserDNNotificationMessageTemplateElement |
| | | extends NotificationMessageTemplateElement |
| | | { |
| | | /** |
| | | * Creates a new user DN notification message template element. |
| | | */ |
| | | /** Creates a new user DN notification message template element. */ |
| | | public UserDNNotificationMessageTemplateElement() |
| | | { |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void generateValue(LocalizableMessageBuilder buffer, |
| | | AccountStatusNotification notification) |
| | | { |
| | | buffer.append(notification.getUserDN()); |
| | | } |
| | | } |
| | | |
| | |
| | | /** The current configuration for this virtual attribute provider. */ |
| | | private UserDefinedVirtualAttributeCfg currentConfig; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this member virtual attribute provider. |
| | | */ |
| | | /** Creates a new instance of this member virtual attribute provider. */ |
| | | public UserDefinedVirtualAttributeProvider() |
| | | { |
| | | super(); |
| | |
| | | // initializeVirtualAttributeProvider method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeVirtualAttributeProvider( |
| | | UserDefinedVirtualAttributeCfg configuration) |
| | |
| | | configuration.addUserDefinedChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeVirtualAttributeProvider() |
| | | { |
| | | currentConfig.removeUserDefinedChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMultiValued() |
| | | { |
| | | return currentConfig == null || currentConfig.getValue().size() > 1; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Attribute getValues(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isSearchable(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation, |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processSearch(VirtualAttributeRule rule, |
| | | SearchOperation searchOperation) |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | UserDefinedVirtualAttributeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | UserDefinedVirtualAttributeCfg configuration) |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | } |
| | | |
| | |
| | | /** The DN of the target group that will provide membership information. */ |
| | | private DN targetGroupDN; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new, uninitialized virtual static group instance. This is |
| | | * intended for internal use only. |
| | |
| | | // No initialization is required here. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new virtual static group instance with the provided information. |
| | | * |
| | |
| | | this.targetGroupDN = targetGroupDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeGroupImplementation( |
| | | VirtualStaticGroupImplementationCfg configuration) |
| | |
| | | // No additional initialization is required. |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public VirtualStaticGroup newInstance(ServerContext serverContext, Entry groupEntry) |
| | | throws DirectoryException |
| | | { |
| | | ifNull(groupEntry); |
| | | |
| | | |
| | | // Get the target group DN attribute from the entry, if there is one. |
| | | DN targetDN = null; |
| | | AttributeType targetType = DirectoryServer.getAttributeType(ATTR_TARGET_GROUP_DN); |
| | |
| | | return new VirtualStaticGroup(groupEntry.getName(), targetDN); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SearchFilter getGroupDefinitionFilter() |
| | | throws DirectoryException |
| | |
| | | OC_VIRTUAL_STATIC_GROUP + ")"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isGroupDefinition(Entry entry) |
| | | { |
| | |
| | | return entry.hasObjectClass(virtualStaticGroupClass); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getGroupDN() |
| | | { |
| | | return groupEntryDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setGroupDN(DN groupDN) |
| | | { |
| | | groupEntryDN = groupDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the DN of the target group for this virtual static group. |
| | | * |
| | |
| | | return targetGroupDN; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsNestedGroups() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<DN> getNestedGroupDNs() |
| | | { |
| | |
| | | return Collections.<DN>emptyList(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMember(DN userDN, Set<DN> examinedGroups) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMember(Entry userEntry, Set<DN> examinedGroups) |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MemberList getMembers() |
| | | throws DirectoryException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MemberList getMembers(DN baseDN, SearchScope scope, |
| | | SearchFilter filter) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean mayAlterMemberList() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void updateMembers(List<Modification> modifications) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addMember(Entry userEntry) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeMember(DN userDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | |
| | | throw new UnsupportedOperationException(message.toString()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | |
| | | buffer.append(")"); |
| | | } |
| | | } |
| | | |
| | |
| | | super(newHashSet(OID_PROXIED_AUTH_V1, OID_PROXIED_AUTH_V2)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeExtendedOperationHandler( |
| | | WhoAmIExtendedOperationHandlerCfg config) |
| | |
| | | super.initializeExtendedOperationHandler(config); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processExtendedOperation(ExtendedOperation operation) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | // Get the authorization DN for the operation and add it to the response |
| | | // value. |
| | | String authzID; |
| | |
| | | operation.setResultCode(ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationOID() |
| | | { |
| | | return OID_WHO_AM_I_REQUEST; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtendedOperationName() |
| | | { |
| | |
| | | abstract class AbstractTextAccessLogPublisher |
| | | <T extends AccessLogPublisherCfg> extends AccessLogPublisher<T> |
| | | { |
| | | /** |
| | | * Criteria based filter. |
| | | */ |
| | | /** Criteria based filter. */ |
| | | static final class CriteriaFilter implements Filter |
| | | { |
| | | private final AccessLogFilteringCriteriaCfg cfg; |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConnectLoggable(final ClientConnection connection) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDisconnectLoggable(final ClientConnection connection) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRequestLoggable(final Operation operation) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isResponseLoggable(final Operation operation) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Log message filter predicate. |
| | | */ |
| | | /** Log message filter predicate. */ |
| | | private static interface Filter |
| | | { |
| | | /** |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * A filter which performs a logical OR over a set of sub-filters. |
| | | */ |
| | | /** A filter which performs a logical OR over a set of sub-filters. */ |
| | | private static final class OrFilter implements Filter |
| | | { |
| | | private final Filter[] subFilters; |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConnectLoggable(final ClientConnection connection) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDisconnectLoggable(final ClientConnection connection) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRequestLoggable(final Operation operation) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isResponseLoggable(final Operation operation) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConnectLoggable(final ClientConnection connection) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDisconnectLoggable(final ClientConnection connection) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isRequestLoggable(final Operation operation) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isResponseLoggable(final Operation operation) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Configuration change listener. |
| | | */ |
| | | /** Configuration change listener. */ |
| | | private final class ChangeListener implements |
| | | ConfigurationChangeListener<AccessLogPublisherCfg> |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ConfigChangeResult applyConfigurationChange( |
| | | final AccessLogPublisherCfg configuration) |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final boolean isConfigurationChangeAcceptable( |
| | | final AccessLogPublisherCfg configuration, |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Filter criteria configuration listener. |
| | | */ |
| | | /** Filter criteria configuration listener. */ |
| | | private final class FilterListener implements |
| | | ConfigurationChangeListener<AccessLogFilteringCriteriaCfg>, |
| | | ConfigurationAddListener<AccessLogFilteringCriteriaCfg>, |
| | | ConfigurationDeleteListener<AccessLogFilteringCriteriaCfg> |
| | | { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | final AccessLogFilteringCriteriaCfg configuration) |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | final AccessLogFilteringCriteriaCfg configuration) |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | final AccessLogFilteringCriteriaCfg configuration) |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | final AccessLogFilteringCriteriaCfg configuration, |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | final AccessLogFilteringCriteriaCfg configuration, |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | final AccessLogFilteringCriteriaCfg configuration, |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | /** The tracer object for the debug logger. */ |
| | | protected static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | private AccessLogPublisherCfg cfg; |
| | | private Filter filter; |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final void close() |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final DN getDN() |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Release any resources owned by the sub-implementation. |
| | | */ |
| | | /** Release any resources owned by the sub-implementation. */ |
| | | protected abstract void close0(); |
| | | |
| | | |
| opendj-server-legacy/src/main/java/org/opends/server/loggers/AccessLogPublisher.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/AccessLogger.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/ActionType.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/ConsoleDebugLogPublisher.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugLogPublisher.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugLogger.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugStackTraceFormatter.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/EncryptAction.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/ErrorLogPublisher.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/ErrorLogger.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/FileComparator.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/FileNumberRetentionPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/FixedTimeRotationPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/FreeDiskSpaceRetentionPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/HTTPAccessLogPublisher.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/HTTPAccessLogger.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/JDKLogging.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/JDKLoggingFormater.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/LogFileFilter.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/MeteredStream.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/MultifileTextWriter.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/RotationActionThread.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/SizeBasedRetentionPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/SizeBasedRotationPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextWriter.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/ThreadFilterTextErrorLogPublisher.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/TimeLimitRotationPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/TimeStampNaming.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java
opendj-server-legacy/src/main/java/org/opends/server/loggers/slf4j/OpenDJLoggerFactory.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/ChangeNumberControlPlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/LDAPADListPlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/UniqueAttributePlugin.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileStack.java
opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfilerThread.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/LDIFConnectionHandler.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/DirectoryRMIServerSocketFactory.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/OpendsJmxPrincipal.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ASN1ByteChannelReader.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/AbandonRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/BindRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/CompareRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteResponseProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/IntermediateResponseProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConstants.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPControl.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPMessage.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPModification.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPRequestHandler.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPResultCode.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPStatistics.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyDNRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultReferenceProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/UnbindRequestProtocolOp.java
opendj-server-legacy/src/main/java/org/opends/server/replication/common/ServerStatus.java
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/GenerationIdChecksum.java
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/ReplLDIFOutputStream.java
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/ReplicationRepairRequestControl.java
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/NotSupportedOldVersionPDUException.java
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/RoutableMsg.java
opendj-server-legacy/src/main/java/org/opends/server/tasks/EnterLockdownModeTask.java
opendj-server-legacy/src/main/java/org/opends/server/tasks/LeaveLockdownModeTask.java
opendj-server-legacy/src/main/java/org/opends/server/tasks/RestartTaskThread.java
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTaskThread.java
opendj-server-legacy/src/main/java/org/opends/server/tools/PromptTrustManager.java
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/PurgeHistoricalScheduleInformation.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/FileTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/FirstNameTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/GUIDTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/LastNameTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/ListTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStream.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStreamThread.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/ParentDNTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/PresenceTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RDNTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RandomTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/SequentialTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/StaticTextTag.java
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
opendj-server-legacy/src/main/java/org/opends/server/types/AcceptRejectWarn.java
opendj-server-legacy/src/main/java/org/opends/server/types/AccountStatusNotificationProperty.java
opendj-server-legacy/src/main/java/org/opends/server/types/AccountStatusNotificationType.java
opendj-server-legacy/src/main/java/org/opends/server/types/AuthenticationType.java
opendj-server-legacy/src/main/java/org/opends/server/types/BackupInfo.java
opendj-server-legacy/src/main/java/org/opends/server/types/DisconnectReason.java
opendj-server-legacy/src/main/java/org/opends/server/types/EntryEncodeConfig.java
opendj-server-legacy/src/main/java/org/opends/server/types/ExistingFileBehavior.java
opendj-server-legacy/src/main/java/org/opends/server/types/FilterType.java
opendj-server-legacy/src/main/java/org/opends/server/types/IndexType.java
opendj-server-legacy/src/main/java/org/opends/server/types/IntermediateResponse.java
opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportResult.java
opendj-server-legacy/src/main/java/org/opends/server/types/LockType.java
opendj-server-legacy/src/main/java/org/opends/server/types/OperationType.java
opendj-server-legacy/src/main/java/org/opends/server/types/SSLClientAuthPolicy.java
opendj-server-legacy/src/main/java/org/opends/server/util/ChangeRecordEntry.java
opendj-server-legacy/src/main/java/org/opends/server/util/DeleteChangeRecordEntry.java
opendj-server-legacy/src/main/java/org/opends/server/util/ExpirationCheckTrustManager.java
opendj-server-legacy/src/main/java/org/opends/server/util/ModifyDNChangeRecordEntry.java
opendj-server-legacy/src/main/java/org/opends/server/util/MultiOutputStream.java
opendj-server-legacy/src/main/java/org/opends/server/util/SizeLimitInputStream.java
opendj-server-legacy/src/test/java/org/opends/server/TestTextWriter.java
opendj-server-legacy/src/test/java/org/opends/server/api/AlertHandlerTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/api/AuthenticationPolicyTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/AESPasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/Base64PasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/BlowfishPasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/ClearPasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/MD5PasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/RC4PasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/SASLOverTLSTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/SHA1PasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedMD5PasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/TestAccountStatusNotificationHandler.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/TestAlertGenerator.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/TripleDESPasswordStorageSchemeTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/monitors/StackTraceMonitorTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/monitors/SystemInfoMonitorTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/monitors/TraditionalWorkQueueMonitorTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/monitors/VersionMonitorTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/TestInternalSearchListener.java
opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/PostConnectedDisconnectTest.java
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ExternalChangelogDomainFakeCfg.java
opendj-server-legacy/src/test/java/org/opends/server/tasks/LdifFileWriter.java |