| | |
| | | |
| | | // If it's a self change, then see if that's allowed. |
| | | if (selfChange && |
| | | (! pwPolicyState.getPolicy().allowUserPasswordChanges())) |
| | | (! pwPolicyState.getPolicy().isAllowUserPasswordChanges())) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.PASSWORD_MOD_NOT_ALLOWED; |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | |
| | | // If we require secure password changes, then makes sure it's a |
| | | // secure communication channel. |
| | | if (pwPolicyState.getPolicy().requireSecurePasswordChanges() && |
| | | if (pwPolicyState.getPolicy().isRequireSecurePasswordChanges() && |
| | | (! clientConnection.isSecure())) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.PASSWORD_MOD_NOT_ALLOWED; |
| | |
| | | // If there were multiple password values, then make sure that's |
| | | // OK. |
| | | if ((!isInternalOperation()) |
| | | && (!pwPolicyState.getPolicy().allowMultiplePasswordValues()) |
| | | && (!pwPolicyState.getPolicy().isAllowMultiplePasswordValues()) |
| | | && (passwordsToAdd > 1)) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.PASSWORD_MOD_NOT_ALLOWED; |
| | |
| | | if (pwPolicyState.passwordIsPreEncoded(v.getValue())) |
| | | { |
| | | if ((!isInternalOperation()) |
| | | && !pwPolicyState.getPolicy().allowPreEncodedPasswords()) |
| | | && !pwPolicyState.getPolicy().isAllowPreEncodedPasswords()) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.INSUFFICIENT_PASSWORD_QUALITY; |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | { |
| | | for (AttributeValue av : attr) |
| | | { |
| | | if (pwPolicyState.getPolicy().usesAuthPasswordSyntax()) |
| | | if (pwPolicyState.getPolicy().isAuthPasswordSyntax()) |
| | | { |
| | | if (AuthPasswordSyntax.isEncoded(av.getValue())) |
| | | { |
| | |
| | | // If it was a self change, then see if the current password was provided |
| | | // and handle accordingly. |
| | | if (selfChange && |
| | | pwPolicyState.getPolicy().requireCurrentPassword() && |
| | | pwPolicyState.getPolicy().isPasswordChangeRequiresCurrentPassword() && |
| | | (! currentPasswordProvided)) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.MUST_SUPPLY_OLD_PASSWORD; |
| | |
| | | // If this change would result in multiple password values, then see if |
| | | // that's OK. |
| | | if ((numPasswords > 1) && |
| | | (! pwPolicyState.getPolicy().allowMultiplePasswordValues())) |
| | | (! pwPolicyState.getPolicy().isAllowMultiplePasswordValues())) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.PASSWORD_MOD_NOT_ALLOWED; |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | |
| | | // If any of the password values should be validated, then do so now. |
| | | if (selfChange || |
| | | (! pwPolicyState.getPolicy().skipValidationForAdministrators())) |
| | | (! pwPolicyState.getPolicy().isSkipValidationForAdministrators())) |
| | | { |
| | | if (newPasswords != null) |
| | | { |
| | |
| | | if (pwPolicyState.isPasswordInHistory(v.getValue())) |
| | | { |
| | | if (selfChange || (! pwPolicyState.getPolicy(). |
| | | skipValidationForAdministrators())) |
| | | isSkipValidationForAdministrators())) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.PASSWORD_IN_HISTORY; |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | pwPolicyState.clearGraceLoginTimes(); |
| | | pwPolicyState.clearWarnedTime(); |
| | | |
| | | if (pwPolicyState.getPolicy().forceChangeOnAdd() || |
| | | pwPolicyState.getPolicy().forceChangeOnReset()) |
| | | if (pwPolicyState.getPolicy().isForceChangeOnAdd() || |
| | | pwPolicyState.getPolicy().isForceChangeOnReset()) |
| | | { |
| | | if (selfChange) |
| | | { |
| | |
| | | else |
| | | { |
| | | if ((pwpErrorType == null) && |
| | | pwPolicyState.getPolicy().forceChangeOnReset()) |
| | | pwPolicyState.getPolicy().isForceChangeOnReset()) |
| | | { |
| | | pwpErrorType = PasswordPolicyErrorType.CHANGE_AFTER_RESET; |
| | | } |
| | | |
| | | pwPolicyState.setMustChangePassword( |
| | | pwPolicyState.getPolicy().forceChangeOnReset()); |
| | | pwPolicyState.getPolicy().isForceChangeOnReset()); |
| | | } |
| | | } |
| | | |