0N/A/*
0N/A * CDDL HEADER START
0N/A *
0N/A * The contents of this file are subject to the terms of the
0N/A * Common Development and Distribution License, Version 1.0 only
0N/A * (the "License"). You may not use this file except in compliance
0N/A * with the License.
0N/A *
6983N/A * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
6983N/A * or http://forgerock.org/license/CDDLv1.0.html.
0N/A * See the License for the specific language governing permissions
0N/A * and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL HEADER in each
6983N/A * file and include the License file at legal-notices/CDDLv1_0.txt.
6983N/A * If applicable, add the following below this CDDL HEADER, with the
6983N/A * fields enclosed by brackets "[]" replaced with your own identifying
6983N/A * information:
0N/A * Portions Copyright [yyyy] [name of copyright owner]
0N/A *
0N/A * CDDL HEADER END
0N/A *
0N/A *
3215N/A * Copyright 2006-2008 Sun Microsystems, Inc.
0N/A */
0N/Apackage org.opends.server.api;
2086N/Aimport org.opends.messages.Message;
0N/A
0N/A
0N/A
1787N/Aimport java.util.List;
366N/Aimport java.util.Set;
366N/A
1177N/Aimport org.opends.server.admin.std.server.PasswordValidatorCfg;
0N/Aimport org.opends.server.config.ConfigException;
4134N/Aimport org.opends.server.types.*;
0N/A
2086N/Aimport org.opends.messages.MessageBuilder;
0N/A
0N/A
0N/A/**
0N/A * This class defines the set of methods and structures that must be
0N/A * implemented by a Directory Server module that may be used to
0N/A * determine whether a proposed password is acceptable for a user.
1008N/A *
1008N/A * @param <T> The type of configuration handled by this password
1008N/A * validator.
0N/A */
2095N/A@org.opends.server.types.PublicAPI(
2095N/A stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
2095N/A mayInstantiate=false,
2095N/A mayExtend=true,
2095N/A mayInvoke=false)
0N/Apublic abstract class PasswordValidator
1008N/A <T extends PasswordValidatorCfg>
0N/A{
0N/A /**
0N/A * Initializes this password validator based on the information in
0N/A * the provided configuration entry.
0N/A *
1008N/A * @param configuration The configuration to use to initialize
1008N/A * this password validator.
0N/A *
0N/A * @throws ConfigException If an unrecoverable problem arises in
0N/A * the process of performing the
0N/A * initialization.
0N/A *
0N/A * @throws InitializationException If a problem occurs during
0N/A * initialization that is not
0N/A * related to the server
0N/A * configuration.
0N/A */
1008N/A public abstract void initializePasswordValidator(T configuration)
0N/A throws ConfigException, InitializationException;
0N/A
0N/A
0N/A
0N/A /**
1787N/A * Indicates whether the provided configuration is acceptable for
1787N/A * this password validator. It should be possible to call this
1787N/A * method on an uninitialized password validator instance in order
1787N/A * to determine whether the password validator would be able to use
1787N/A * the provided configuration.
1787N/A * <BR><BR>
1787N/A * Note that implementations which use a subclass of the provided
1787N/A * configuration class will likely need to cast the configuration
1787N/A * to the appropriate subclass type.
1787N/A *
1787N/A * @param configuration The password validator configuration
1787N/A * for which to make the determination.
1787N/A * @param unacceptableReasons A list that may be used to hold the
1787N/A * reasons that the provided
1787N/A * configuration is not acceptable.
1787N/A *
1787N/A * @return {@code true} if the provided configuration is acceptable
1787N/A * for this password validator, or {@code false} if not.
1787N/A */
1787N/A public boolean isConfigurationAcceptable(
1787N/A PasswordValidatorCfg configuration,
2086N/A List<Message> unacceptableReasons)
1787N/A {
1787N/A // This default implementation does not perform any special
1787N/A // validation. It should be overridden by password validator
1787N/A // implementations that wish to perform more detailed validation.
1787N/A return true;
1787N/A }
1787N/A
1787N/A
1787N/A
1787N/A /**
0N/A * Performs any finalization that might be required when this
0N/A * password validator is unloaded. No action is taken in the
0N/A * default implementation.
0N/A */
0N/A public void finalizePasswordValidator()
0N/A {
0N/A // No action is required by default.
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Indicates whether the provided password is acceptable for use by
0N/A * the specified user. If the password is determined to be
0N/A * unacceptable, then a human-readable explanation should be
0N/A * appended to the provided buffer.
0N/A *
366N/A * @param newPassword The proposed clear-text password that
366N/A * should be validated.
366N/A * @param currentPasswords The set of clear-text current passwords
366N/A * for the user (if available). Note that
366N/A * the current passwords may not always be
366N/A * available, and this may not comprise
366N/A * entire set of passwords currently
366N/A * for the user.
366N/A * @param operation The operation that is being used to set
366N/A * the password. It may be an add, a
366N/A * modify, or a password modify operation.
366N/A * @param userEntry The entry for the user whose password
366N/A * is being changed.
366N/A * @param invalidReason The buffer to which the human-readable
366N/A * explanation should be appended if it is
366N/A * determined that the password is not
366N/A * acceptable.
0N/A *
2095N/A * @return {@code true} if the password is acceptable, or
2095N/A * {@code false} if not.
0N/A */
366N/A public abstract boolean passwordIsAcceptable(ByteString newPassword,
366N/A Set<ByteString> currentPasswords,
0N/A Operation operation,
0N/A Entry userEntry,
2086N/A MessageBuilder invalidReason);
0N/A}
0N/A