RepeatedCharactersPasswordValidator.java revision 99faa045b6241c1d2843cce1b7a9d9c97055beae
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 * You can obtain a copy of the license at 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * file and include the License file at 0N/A * add the following below this CDDL HEADER, with the fields enclosed 0N/A * by brackets "[]" replaced with your own identifying information: 0N/A * Portions Copyright [yyyy] [name of copyright owner] 0N/A * Portions Copyright 2007 Sun Microsystems, Inc. 0N/A * This class provides an OpenDS password validator that may be used to ensure 0N/A * that proposed passwords are not allowed to have the same character appear 0N/A * several times consecutively. 0N/A // The current configuration for this password validator. 0N/A * Creates a new instance of this repeated characters password validator. 0N/A // No implementation is required here. All initialization should be 0N/A // performed in the initializePasswordValidator() method. 0N/A // Get a handle to the current configuration and see if we need to count 0N/A // the number of repeated characters in the password. 0N/A // We don't need to check anything, so the password will be acceptable. 0N/A // Get the password as a string. If we should use case-insensitive 0N/A // validation, then convert it to use all lowercase characters. 0N/A // Create variables to keep track of the last character we've seen and how 0N/A // many times we have seen it. 0N/A // Iterate through the characters in the password. If the consecutive 0N/A // count ever gets too high, then fail. 0N/A // All of the necessary validation should have been performed automatically, 0N/A // so if we get to this point then the new configuration will be acceptable. 0N/A // For this password validator, we will always be able to successfully apply 0N/A // the new configuration.