| | |
| | | // make sure that's OK. |
| | | if (oldPassword == null) |
| | | { |
| | | if (selfChange && pwPolicyState.getPolicy().requireCurrentPassword()) |
| | | if (selfChange |
| | | && pwPolicyState.getPolicy() |
| | | .isPasswordChangeRequiresCurrentPassword()) |
| | | { |
| | | operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | if (pwPolicyState.getPolicy().requireSecureAuthentication() && |
| | | if (pwPolicyState.getPolicy().isRequireSecureAuthentication() && |
| | | (! operation.getClientConnection().isSecure())) |
| | | { |
| | | operation.setResultCode(ResultCode.CONFIDENTIALITY_REQUIRED); |
| | |
| | | // If it is a self password change and we don't allow that, then reject |
| | | // the request. |
| | | if (selfChange && |
| | | (! pwPolicyState.getPolicy().allowUserPasswordChanges())) |
| | | (! pwPolicyState.getPolicy().isAllowUserPasswordChanges())) |
| | | { |
| | | if (pwPolicyRequested) |
| | | { |
| | |
| | | |
| | | // If we require secure password changes and the connection isn't secure, |
| | | // then reject the request. |
| | | if (pwPolicyState.getPolicy().requireSecurePasswordChanges() && |
| | | if (pwPolicyState.getPolicy().isRequireSecurePasswordChanges() && |
| | | (! operation.getClientConnection().isSecure())) |
| | | { |
| | | |
| | |
| | | // If the user's password is expired and it's a self-change request, then |
| | | // see if that's OK. |
| | | if ((selfChange && pwPolicyState.isPasswordExpired() && |
| | | (! pwPolicyState.getPolicy().allowExpiredPasswordChanges()))) |
| | | (! pwPolicyState.getPolicy().isAllowExpiredPasswordChanges()))) |
| | | { |
| | | if (pwPolicyRequested) |
| | | { |
| | |
| | | // by an internal operation or during synchronization, so we don't |
| | | // need to check for those cases. |
| | | isPreEncoded = true; |
| | | if (! pwPolicyState.getPolicy().allowPreEncodedPasswords()) |
| | | if (! pwPolicyState.getPolicy().isAllowPreEncodedPasswords()) |
| | | { |
| | | operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | |
| | | else |
| | | { |
| | | // Run the new password through the set of password validators. |
| | | if (selfChange || |
| | | (! pwPolicyState.getPolicy().skipValidationForAdministrators())) |
| | | if (selfChange |
| | | || (!pwPolicyState.getPolicy() |
| | | .isSkipValidationForAdministrators())) |
| | | { |
| | | HashSet<ByteString> clearPasswords; |
| | | if (oldPassword == null) |
| | |
| | | if (pwPolicyState.isPasswordInHistory(newPassword)) |
| | | { |
| | | if (selfChange || (! pwPolicyState.getPolicy(). |
| | | skipValidationForAdministrators())) |
| | | isSkipValidationForAdministrators())) |
| | | { |
| | | operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | |
| | | Set<AttributeValue> existingValues = pwPolicyState.getPasswordValues(); |
| | | LinkedHashSet<AttributeValue> deleteValues = |
| | | new LinkedHashSet<AttributeValue>(existingValues.size()); |
| | | if (pwPolicyState.getPolicy().usesAuthPasswordSyntax()) |
| | | if (pwPolicyState.getPolicy().isAuthPasswordSyntax()) |
| | | { |
| | | for (AttributeValue v : existingValues) |
| | | { |
| | |
| | | else |
| | | { |
| | | pwPolicyState.setMustChangePassword( |
| | | pwPolicyState.getPolicy().forceChangeOnReset()); |
| | | pwPolicyState.getPolicy().isForceChangeOnReset()); |
| | | } |
| | | |
| | | |