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 has been temporarily locked as a result of too 045 * many failed authentication attempts. The account will remain locked until 046 * the lockout period expires or until it is manually unlocked by an 047 * administrator (e.g., by a password reset). 048 */ 049 ACCOUNT_TEMPORARILY_LOCKED("account-temporarily-locked"), 050 051 052 053 /** 054 * Indicates that an account has been permanently locked as a result of too 055 * many failed authentication attempts. The account will remain locked until 056 * it is manually unlocked by an administrator (e.g., by a password reset). 057 */ 058 ACCOUNT_PERMANENTLY_LOCKED("account-permanently-locked"), 059 060 061 062 /** 063 * Indicates that a failure-locked, idle-locked, or reset-locked account has 064 * been unlocked by an administrator (e.g., by a password reset). 065 */ 066 ACCOUNT_UNLOCKED("account-unlocked"), 067 068 069 070 /** 071 * Indicates than an authentication attempt failed because too much time had 072 * elapsed since the account last successfully authenticated. 073 */ 074 ACCOUNT_IDLE_LOCKED("account-idle-locked"), 075 076 077 078 /** 079 * Indicates than an authentication attempt failed because the user was 080 * required to change their password after an administrative password reset, 081 * but that they did not do so within the required interval. 082 */ 083 ACCOUNT_RESET_LOCKED("account-reset-locked"), 084 085 086 087 /** 088 * Indicates that an account has been disabled by an administrator. 089 */ 090 ACCOUNT_DISABLED("account-disabled"), 091 092 093 094 /** 095 * Indicates that an account has been enabled by an administrator. 096 */ 097 ACCOUNT_ENABLED("account-enabled"), 098 099 100 101 /** 102 * Indicates than an authentication attempt failed because the account has an 103 * activation time that is in the future. 104 */ 105 ACCOUNT_NOT_YET_ACTIVE("account-not-yet-active"), 106 107 108 109 /** 110 * Indicates than an authentication attempt failed because the account has an 111 * expiration time that is in the past. 112 */ 113 ACCOUNT_EXPIRED("account-expired"), 114 115 116 117 /** 118 * Indicates than an authentication attempt failed because the account has an 119 * expired password. 120 */ 121 PASSWORD_EXPIRED("password-expired"), 122 123 124 125 /** 126 * Indicates that an authentication attempt succeeded, but that the password 127 * will expire in the near future. This notification will only be generated 128 * the first time that an expiration warning is generated for a password. 129 */ 130 PASSWORD_EXPIRING("password-expiring"), 131 132 133 134 /** 135 * Indicates that a user's password has been reset by an administrator. 136 */ 137 PASSWORD_RESET("password-reset"), 138 139 140 141 /** 142 * Indicates that a user has changed their own password. 143 */ 144 PASSWORD_CHANGED("password-changed"), 145 146 147 148 /** 149 * Indicates that an account has been created with an add request that 150 * matches a defined set of criteria. 151 */ 152 ACCOUNT_CREATED("account-created"), 153 154 155 156 /** 157 * Indicates that an account has been updated with a modify or modify DN 158 * request that matches a defined set of criteria. 159 */ 160 ACCOUNT_UPDATED("account-updated"); 161 162 163 164 // The notification type name. 165 private final String name; 166 167 168 169 /** 170 * Creates a new account status notification type with the provided 171 * name. 172 * 173 * @param name The name for this account status notification type. 174 */ 175 AccountStatusNotificationType(final String name) 176 { 177 this.name = name; 178 } 179 180 181 182 /** 183 * Retrieves the account status notification type with the specified 184 * name. 185 * 186 * @param name The name for the account status notification type 187 * to retrieve. 188 * 189 * @return The requested account status notification type, or 190 * <CODE>null</CODE> if there is no type with the given 191 * name. 192 */ 193 public static AccountStatusNotificationType typeForName(final String name) 194 { 195 final String lowerName = StaticUtils.toLowerCase(name); 196 if (lowerName.equals("account-temporarily-locked")) 197 { 198 return ACCOUNT_TEMPORARILY_LOCKED; 199 } 200 else if (lowerName.equals("account-permanently-locked")) 201 { 202 return ACCOUNT_PERMANENTLY_LOCKED; 203 } 204 else if (lowerName.equals("account-unlocked")) 205 { 206 return ACCOUNT_UNLOCKED; 207 } 208 else if (lowerName.equals("account-idle-locked")) 209 { 210 return ACCOUNT_IDLE_LOCKED; 211 } 212 else if (lowerName.equals("account-reset-locked")) 213 { 214 return ACCOUNT_RESET_LOCKED; 215 } 216 else if (lowerName.equals("account-disabled")) 217 { 218 return ACCOUNT_DISABLED; 219 } 220 else if (lowerName.equals("account-enabled")) 221 { 222 return ACCOUNT_ENABLED; 223 } 224 else if (lowerName.equals("account-not-yet-active")) 225 { 226 return ACCOUNT_NOT_YET_ACTIVE; 227 } 228 else if (lowerName.equals("account-expired")) 229 { 230 return ACCOUNT_EXPIRED; 231 } 232 else if (lowerName.equals("password-expired")) 233 { 234 return PASSWORD_EXPIRED; 235 } 236 else if (lowerName.equals("password-expiring")) 237 { 238 return PASSWORD_EXPIRING; 239 } 240 else if (lowerName.equals("password-reset")) 241 { 242 return PASSWORD_RESET; 243 } 244 else if (lowerName.equals("password-changed")) 245 { 246 return PASSWORD_CHANGED; 247 } 248 else if (lowerName.equals("account-created")) 249 { 250 return ACCOUNT_CREATED; 251 } 252 else if (lowerName.equals("account-updated")) 253 { 254 return ACCOUNT_UPDATED; 255 } 256 else 257 { 258 return null; 259 } 260 } 261 262 263 264 /** 265 * Retrieves the name for this account status notification type. 266 * 267 * @return The name for this account status notification type. 268 */ 269 public String getName() 270 { 271 return name; 272 } 273 274 275 276 /** 277 * Retrieves a string representation of this account status 278 * notification type. 279 * 280 * @return A string representation of this account status 281 * notification type. 282 */ 283 public String toString() 284 { 285 return name; 286 } 287} 288