001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at 010 * http://www.opensource.org/licenses/cddl1.php. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file. If applicable, add the following below this CDDL HEADER, 016 * with the fields enclosed by brackets "[]" replaced with your own 017 * identifying information: 018 * Portions Copyright [yyyy] [name of copyright owner] 019 * 020 * CDDL HEADER END 021 * 022 * 023 * Portions Copyright 2007-2019 Ping Identity Corporation 024 * Portions Copyright 2006-2008 Sun Microsystems, Inc. 025 */ 026package com.unboundid.directory.sdk.ds.types; 027 028 029 030import com.unboundid.util.ThreadSafety; 031import com.unboundid.util.ThreadSafetyLevel; 032import com.unboundid.util.StaticUtils; 033 034 035 036/** 037 * This class implements an enumeration that holds the possible event types that 038 * can trigger an account status notification. 039 */ 040@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 041public enum AccountStatusNotificationType 042{ 043 /** 044 * Indicates that an account status message should be generated whenever a 045 * user account has been temporarily locked after too many failed attempts. 046 */ 047 ACCOUNT_TEMPORARILY_LOCKED("account-temporarily-locked"), 048 049 050 051 /** 052 * Indicates that an account status message should be generated whenever a 053 * user account has been permanently locked (requiring an administrative 054 * password reset) after too many failed attempts. 055 */ 056 ACCOUNT_PERMANENTLY_LOCKED("account-permanently-locked"), 057 058 059 060 /** 061 * Indicates that an account status message should be generated whenever a 062 * user account has been unlocked by an administrator. 063 */ 064 ACCOUNT_UNLOCKED("account-unlocked"), 065 066 067 068 /** 069 * Indicates that an account status message should be generated whenever a 070 * user account has been locked because it was idle for too long. 071 */ 072 ACCOUNT_IDLE_LOCKED("account-idle-locked"), 073 074 075 076 /** 077 * Indicates that an account status message should be generated whenever a 078 * user account has been locked because it the password had been reset by an 079 * administrator but not changed by the user within the required interval. 080 */ 081 ACCOUNT_RESET_LOCKED("account-reset-locked"), 082 083 084 085 /** 086 * Indicates that an account status message should be generated whenever a 087 * user account has been disabled by an administrator. 088 */ 089 ACCOUNT_DISABLED("account-disabled"), 090 091 092 093 /** 094 * Indicates that an account status message should be generated whenever a 095 * user account has been enabled by an administrator. 096 */ 097 ACCOUNT_ENABLED("account-enabled"), 098 099 100 101 /** 102 * Indicates that an account status message should be generated whenever a 103 * user authentication has failed because the account activation time is still 104 * in the future. 105 */ 106 ACCOUNT_NOT_YET_ACTIVE("account-not-yet-active"), 107 108 109 110 /** 111 * Indicates that an account status message should be generated whenever a 112 * user authentication has failed because the account has expired. 113 */ 114 ACCOUNT_EXPIRED("account-expired"), 115 116 117 118 /** 119 * Indicates that an account status notification message should be generated 120 * whenever a user authentication has failed because the password has expired. 121 */ 122 PASSWORD_EXPIRED("password-expired"), 123 124 125 126 127 /** 128 * Indicates that an account status notification message should be generated 129 * the first time that a password expiration warning is encountered for a user 130 * password. 131 */ 132 PASSWORD_EXPIRING("password-expiring"), 133 134 135 136 /** 137 * Indicates that an account status notification message should be generated 138 * whenever a user's password is reset by an administrator. 139 */ 140 PASSWORD_RESET("password-reset"), 141 142 143 144 /** 145 * Indicates whether an account status notification message should be 146 * generated whenever a user changes his/her own password. 147 */ 148 PASSWORD_CHANGED("password-changed"); 149 150 151 152 // The notification type name. 153 private final String name; 154 155 156 157 /** 158 * Creates a new account status notification type with the provided 159 * name. 160 * 161 * @param name The name for this account status notification type. 162 */ 163 AccountStatusNotificationType(final String name) 164 { 165 this.name = name; 166 } 167 168 169 170 /** 171 * Retrieves the account status notification type with the specified 172 * name. 173 * 174 * @param name The name for the account status notification type 175 * to retrieve. 176 * 177 * @return The requested account status notification type, or 178 * <CODE>null</CODE> if there is no type with the given 179 * name. 180 */ 181 public static AccountStatusNotificationType typeForName(final String name) 182 { 183 final String lowerName = StaticUtils.toLowerCase(name); 184 if (lowerName.equals("account-temporarily-locked")) 185 { 186 return ACCOUNT_TEMPORARILY_LOCKED; 187 } 188 else if (lowerName.equals("account-permanently-locked")) 189 { 190 return ACCOUNT_PERMANENTLY_LOCKED; 191 } 192 else if (lowerName.equals("account-unlocked")) 193 { 194 return ACCOUNT_UNLOCKED; 195 } 196 else if (lowerName.equals("account-idle-locked")) 197 { 198 return ACCOUNT_IDLE_LOCKED; 199 } 200 else if (lowerName.equals("account-reset-locked")) 201 { 202 return ACCOUNT_RESET_LOCKED; 203 } 204 else if (lowerName.equals("account-disabled")) 205 { 206 return ACCOUNT_DISABLED; 207 } 208 else if (lowerName.equals("account-enabled")) 209 { 210 return ACCOUNT_ENABLED; 211 } 212 else if (lowerName.equals("account-not-yet-active")) 213 { 214 return ACCOUNT_NOT_YET_ACTIVE; 215 } 216 else if (lowerName.equals("account-expired")) 217 { 218 return ACCOUNT_EXPIRED; 219 } 220 else if (lowerName.equals("password-expired")) 221 { 222 return PASSWORD_EXPIRED; 223 } 224 else if (lowerName.equals("password-expiring")) 225 { 226 return PASSWORD_EXPIRING; 227 } 228 else if (lowerName.equals("password-reset")) 229 { 230 return PASSWORD_RESET; 231 } 232 else if (lowerName.equals("password-changed")) 233 { 234 return PASSWORD_CHANGED; 235 } 236 else 237 { 238 return null; 239 } 240 } 241 242 243 244 /** 245 * Retrieves the name for this account status notification type. 246 * 247 * @return The name for this account status notification type. 248 */ 249 public String getName() 250 { 251 return name; 252 } 253 254 255 256 /** 257 * Retrieves a string representation of this account status 258 * notification type. 259 * 260 * @return A string representation of this account status 261 * notification type. 262 */ 263 public String toString() 264 { 265 return name; 266 } 267} 268