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 2010 Sun Microsystems, Inc. 015 * Portions Copyright 2016 ForgeRock AS. 016 */ 017package org.forgerock.opendj.ldap.controls; 018 019/** 020 * A password policy error type as defined in draft-behera-ldap-password-policy 021 * is used to indicate problems concerning a user's account or password. 022 * 023 * @see PasswordPolicyRequestControl 024 * @see PasswordPolicyResponseControl 025 * @see PasswordPolicyWarningType 026 * @see <a href="http://tools.ietf.org/html/draft-behera-ldap-password-policy"> 027 * draft-behera-ldap-password-policy - Password Policy for LDAP Directories 028 * </a> 029 */ 030public enum PasswordPolicyErrorType { 031 /** Indicates that the password has expired and must be reset. */ 032 PASSWORD_EXPIRED(0, "passwordExpired"), 033 034 /** Indicates that the user's account has been locked. */ 035 ACCOUNT_LOCKED(1, "accountLocked"), 036 037 /** 038 * Indicates that the password must be changed before the user will be 039 * allowed to perform any operation other than bind and modify. 040 */ 041 CHANGE_AFTER_RESET(2, "changeAfterReset"), 042 043 /** Indicates that a user is restricted from changing her password. */ 044 PASSWORD_MOD_NOT_ALLOWED(3, "passwordModNotAllowed"), 045 046 /** Indicates that the old password must be supplied in order to modify the password. */ 047 MUST_SUPPLY_OLD_PASSWORD(4, "mustSupplyOldPassword"), 048 049 /** Indicates that a password doesn't pass quality checking. */ 050 INSUFFICIENT_PASSWORD_QUALITY(5, "insufficientPasswordQuality"), 051 052 /** Indicates that a password is not long enough. */ 053 PASSWORD_TOO_SHORT(6, "passwordTooShort"), 054 055 /** Indicates that the age of the password to be modified is not yet old enough. */ 056 PASSWORD_TOO_YOUNG(7, "passwordTooYoung"), 057 058 /** Indicates that a password has already been used and the user must choose a different one. */ 059 PASSWORD_IN_HISTORY(8, "passwordInHistory"); 060 061 private final int intValue; 062 063 private final String name; 064 065 private PasswordPolicyErrorType(final int intValue, final String name) { 066 this.intValue = intValue; 067 this.name = name; 068 } 069 070 @Override 071 public String toString() { 072 return name; 073 } 074 075 /** 076 * Returns the integer value for this password policy error type. 077 * 078 * @return The integer value for this password policy error type. 079 */ 080 int intValue() { 081 return intValue; 082 } 083}