URL: http://svn.apache.org/viewvc?rev=1095083&view=rev
Log:
o created an interface for validating password quality and added an implementation
o updated the authenticator and policy config to use the validator
o added dependency on shared-ldap-extras-codec (required to resolve PasswordPolicyErrorEnum)

- /**
- * The password does not contain three letter (or more) tokens from the user's account name.
- *
- * If the account name is less than three characters long, this check is not performed
- * because the rate at which passwords would be rejected is too high. For each token that is
- * three or more characters long, that token is searched for in the password; if it is present,
- * the password change is rejected. For example, the name "First M. Last" would be split into
- * three tokens: "First", "M", and "Last". Because the second token is only one character long,
- * it would be ignored. Therefore, this user could not have a password that included either
- * "first" or "last" as a substring anywhere in the password. All of these checks are
- * case-insensitive.
- */
- private void checkUsernameSubstring( String username, String password, PasswordPolicyConfiguration policyConfig ) throws PasswordPolicyException
- {
- if ( username == null || username.trim().length() == 0 )
- {
- return;
- }
-
- String[] tokens = username.split( "[^a-zA-Z]" );
-
- for ( int ii = 0; ii < tokens.length; ii++ )
- {
- if ( password.matches( "(?i).*" + tokens[ii] + ".*" ) )
- {
- throw new PasswordPolicyException( "Password shouldn't contain parts of the username",
- INSUFFICIENT_PASSWORD_QUALITY );
- }
- }
- }
-
-
private int getPwdTimeBeforeExpiry( Entry userEntry, PasswordPolicyConfiguration policyConfig ) throws LdapException
{
if ( policyConfig.getPwdMaxAge() == 0 )