001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2008 Sun Microsystems, Inc.
015 */
016package org.forgerock.opendj.server.config.server;
017
018
019
020import java.util.SortedSet;
021import org.forgerock.opendj.config.server.ConfigurationChangeListener;
022
023
024
025/**
026 * A server-side interface for querying Character Set Password
027 * Validator settings.
028 * <p>
029 * The Character Set Password Validator determines whether a proposed
030 * password is acceptable by checking whether it contains a sufficient
031 * number of characters from one or more user-defined character sets
032 * and ranges.
033 */
034public interface CharacterSetPasswordValidatorCfg extends PasswordValidatorCfg {
035
036  /**
037   * Gets the configuration class associated with this Character Set Password Validator.
038   *
039   * @return Returns the configuration class associated with this Character Set Password Validator.
040   */
041  Class<? extends CharacterSetPasswordValidatorCfg> configurationClass();
042
043
044
045  /**
046   * Register to be notified when this Character Set Password Validator is changed.
047   *
048   * @param listener
049   *          The Character Set Password Validator configuration change listener.
050   */
051  void addCharacterSetChangeListener(ConfigurationChangeListener<CharacterSetPasswordValidatorCfg> listener);
052
053
054
055  /**
056   * Deregister an existing Character Set Password Validator configuration change listener.
057   *
058   * @param listener
059   *          The Character Set Password Validator configuration change listener.
060   */
061  void removeCharacterSetChangeListener(ConfigurationChangeListener<CharacterSetPasswordValidatorCfg> listener);
062
063
064
065  /**
066   * Gets the "allow-unclassified-characters" property.
067   * <p>
068   * Indicates whether this password validator allows passwords to
069   * contain characters outside of any of the user-defined character
070   * sets and ranges.
071   * <p>
072   * If this is "false", then only those characters in the
073   * user-defined character sets and ranges may be used in passwords.
074   * Any password containing a character not included in any character
075   * set or range will be rejected.
076   *
077   * @return Returns the value of the "allow-unclassified-characters" property.
078   */
079  boolean isAllowUnclassifiedCharacters();
080
081
082
083  /**
084   * Gets the "character-set" property.
085   * <p>
086   * Specifies a character set containing characters that a password
087   * may contain and a value indicating the minimum number of
088   * characters required from that set.
089   * <p>
090   * Each value must be an integer (indicating the minimum required
091   * characters from the set which may be zero, indicating that the
092   * character set is optional) followed by a colon and the characters
093   * to include in that set (for example,
094   * "3:abcdefghijklmnopqrstuvwxyz" indicates that a user password must
095   * contain at least three characters from the set of lowercase ASCII
096   * letters). Multiple character sets can be defined in separate
097   * values, although no character can appear in more than one
098   * character set.
099   *
100   * @return Returns an unmodifiable set containing the values of the "character-set" property.
101   */
102  SortedSet<String> getCharacterSet();
103
104
105
106  /**
107   * Gets the "character-set-ranges" property.
108   * <p>
109   * Specifies a character range containing characters that a password
110   * may contain and a value indicating the minimum number of
111   * characters required from that range.
112   * <p>
113   * Each value must be an integer (indicating the minimum required
114   * characters from the range which may be zero, indicating that the
115   * character range is optional) followed by a colon and one or more
116   * range specifications. A range specification is 3 characters: the
117   * first character allowed, a minus, and the last character allowed.
118   * For example, "3:A-Za-z0-9". The ranges in each value should not
119   * overlap, and the characters in each range specification should be
120   * ordered.
121   *
122   * @return Returns an unmodifiable set containing the values of the "character-set-ranges" property.
123   */
124  SortedSet<String> getCharacterSetRanges();
125
126
127
128  /**
129   * Gets the "java-class" property.
130   * <p>
131   * Specifies the fully-qualified name of the Java class that
132   * provides the password validator implementation.
133   *
134   * @return Returns the value of the "java-class" property.
135   */
136  String getJavaClass();
137
138
139
140  /**
141   * Gets the "min-character-sets" property.
142   * <p>
143   * Specifies the minimum number of character sets and ranges that a
144   * password must contain.
145   * <p>
146   * This property should only be used in conjunction with optional
147   * character sets and ranges (those requiring zero characters). Its
148   * value must include any mandatory character sets and ranges (those
149   * requiring greater than zero characters). This is useful in
150   * situations where a password must contain characters from mandatory
151   * character sets and ranges, and characters from at least N optional
152   * character sets and ranges. For example, it is quite common to
153   * require that a password contains at least one non-alphanumeric
154   * character as well as characters from two alphanumeric character
155   * sets (lower-case, upper-case, digits). In this case, this property
156   * should be set to 3.
157   *
158   * @return Returns the value of the "min-character-sets" property.
159   */
160  Integer getMinCharacterSets();
161
162}