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-2023 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 successfully authenticated with a bind 150 * request that matches a defined set of criteria. 151 */ 152 ACCOUNT_AUTHENTICATED("account-authenticated"), 153 154 155 156 /** 157 * Indicates that an account has been created with an add request that 158 * matches a defined set of criteria. 159 */ 160 ACCOUNT_CREATED("account-created"), 161 162 163 164 /** 165 * Indicates that an account has been removed with a delete request that 166 * matches a defined set of criteria. 167 */ 168 ACCOUNT_DELETED("account-deleted"), 169 170 171 172 /** 173 * Indicates that an account has been updated with a modify or modify DN 174 * request that matches a defined set of criteria. 175 */ 176 ACCOUNT_UPDATED("account-updated"), 177 178 179 180 /** 181 * Indicates that a bind attempt failed because it used a password that did 182 * not satisfy all of the configured password validators. 183 */ 184 BIND_PASSWORD_FAILED_VALIDATION("bind-password-failed-validation"), 185 186 187 188 /** 189 * Indicates that a user successfully authenticated, but their account is in a 190 * "must change password" state, and the user must choose a new password 191 * before being allowed to perform any other type of operation. 192 */ 193 MUST_CHANGE_PASSWORD("must-change-password"); 194 195 196 197 // The notification type name. 198 private final String name; 199 200 201 202 /** 203 * Creates a new account status notification type with the provided 204 * name. 205 * 206 * @param name The name for this account status notification type. 207 */ 208 AccountStatusNotificationType(final String name) 209 { 210 this.name = name; 211 } 212 213 214 215 /** 216 * Retrieves the account status notification type with the specified 217 * name. 218 * 219 * @param name The name for the account status notification type 220 * to retrieve. 221 * 222 * @return The requested account status notification type, or 223 * <CODE>null</CODE> if there is no type with the given 224 * name. 225 */ 226 public static AccountStatusNotificationType typeForName(final String name) 227 { 228 final String lowerName = StaticUtils.toLowerCase(name); 229 switch (lowerName) 230 { 231 case "account-temporarily-locked": 232 return ACCOUNT_TEMPORARILY_LOCKED; 233 case "account-permanently-locked": 234 return ACCOUNT_PERMANENTLY_LOCKED; 235 case "account-unlocked": 236 return ACCOUNT_UNLOCKED; 237 case "account-idle-locked": 238 return ACCOUNT_IDLE_LOCKED; 239 case "account-reset-locked": 240 return ACCOUNT_RESET_LOCKED; 241 case "account-disabled": 242 return ACCOUNT_DISABLED; 243 case "account-enabled": 244 return ACCOUNT_ENABLED; 245 case "account-not-yet-active": 246 return ACCOUNT_NOT_YET_ACTIVE; 247 case "account-expired": 248 return ACCOUNT_EXPIRED; 249 case "password-expired": 250 return PASSWORD_EXPIRED; 251 case "password-expiring": 252 return PASSWORD_EXPIRING; 253 case "password-reset": 254 return PASSWORD_RESET; 255 case "password-changed": 256 return PASSWORD_CHANGED; 257 case "account-authenticated": 258 return ACCOUNT_AUTHENTICATED; 259 case "account-created": 260 return ACCOUNT_CREATED; 261 case "account-deleted": 262 return ACCOUNT_DELETED; 263 case "account-updated": 264 return ACCOUNT_UPDATED; 265 case "bind-password-failed-validation": 266 return BIND_PASSWORD_FAILED_VALIDATION; 267 case "must-change-password": 268 return MUST_CHANGE_PASSWORD; 269 default: 270 return null; 271 } 272 } 273 274 275 276 /** 277 * Retrieves the name for this account status notification type. 278 * 279 * @return The name for this account status notification type. 280 */ 281 public String getName() 282 { 283 return name; 284 } 285 286 287 288 /** 289 * Retrieves a string representation of this account status 290 * notification type. 291 * 292 * @return A string representation of this account status 293 * notification type. 294 */ 295 @Override() 296 public String toString() 297 { 298 return name; 299 } 300} 301