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 2008-2021 Ping Identity Corporation
024 *      Portions Copyright 2008 Sun Microsystems, Inc.
025 */
026package com.unboundid.directory.sdk.ds.types;
027
028
029
030import com.unboundid.util.StaticUtils;
031import com.unboundid.util.ThreadSafety;
032import com.unboundid.util.ThreadSafetyLevel;
033
034
035
036/**
037 * This class implements an enumeration that holds the possible set of
038 * additional properties that can be included in an account status notification.
039 */
040@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
041public enum AccountStatusNotificationProperty
042{
043  /**
044   * The property whose value will be the name of the account status
045   * notification type.  This will be available for all notification types.
046   */
047  NOTIFICATION_TYPE("notification-type"),
048
049
050
051  /**
052   * The property whose value will be the string representation of the DN of the
053   * password policy for the target user.  This will be available for all
054   * notification types.
055   */
056  PASSWORD_POLICY_DN("password-policy-dn"),
057
058
059
060  /**
061   * The property whose value will be a generalized time representation of the
062   * time that the account status notification was generated.  This will be
063   * available for all notification types.
064   */
065  NOTIFICATION_TIME("notification-time"),
066
067
068
069  /**
070   * The property whose value will the DN of the account with which the
071   * notification is associated.  This will be available for all notification
072   * types.
073   */
074  ACCOUNT_DN("account-dn"),
075
076
077
078  /**
079   * The property whose value will be a generalized time representation of the
080   * time that the account's password was last changed.  This will be available
081   * for all notification types.
082   */
083  PASSWORD_CHANGED_TIME("password-changed-time"),
084
085
086
087  /**
088   * The property whose value will be the number of seconds since the account's
089   * password was last changed.  This will be available for all notification
090   * types.
091   */
092  SECONDS_SINCE_PASSWORD_CHANGE("seconds-since-password-change"),
093
094
095
096  /**
097   * The property whose value will be a localized, human-readable representation
098   * of the time since the account's password was last changed.  This will be
099   * available for all notification types.
100   */
101  TIME_SINCE_PASSWORD_CHANGE("time-since-password-change"),
102
103
104
105  /**
106   * The property whose value will be "true" if the associated account is in a
107   * state that will allow it to authenticate when provided with appropriate
108   * credentials, or "false" if the account is not usable for some reason.  This
109   * will be available for all notification types.
110   */
111  ACCOUNT_IS_USABLE("account-is-usable"),
112
113
114
115  /**
116   * The property whose values will be human-readable messages about error
117   * conditions affecting an account's usability.  This will be available for
118   * all notification types.
119   */
120  ACCOUNT_USABILITY_ERRORS("account-usability-errors"),
121
122
123
124  /**
125   * The property whose values will be human-readable messages about warning
126   * conditions that may affect an account's usability in the near future.  This
127   * will be available for all notification types.
128   */
129  ACCOUNT_USABILITY_WARNINGS("account-usability-warnings"),
130
131
132
133  /**
134   * The property whose values will be human-readable messages about noteworthy
135   * conditions regarding an account that do not necessarily represent a current
136   * or imminent problem with the account.  This will be available for all
137   * notification types.
138   */
139  ACCOUNT_USABILITY_NOTICES("account-usability-notices"),
140
141
142
143  /**
144   * The property whose value will be "true" if the associated account is
145   * administratively disabled, or "false" if the account is enabled.  This will
146   * be available for all notification types.
147   */
148  ACCOUNT_IS_DISABLED("account-is-disabled"),
149
150
151
152  /**
153   * The property whose value will be "true" if the associated account is
154   * not yet active, or "false" if the account either does not have an
155   * activation time or that time is in the past.  This will be available for
156   * all notification types.
157   */
158  ACCOUNT_IS_NOT_YET_ACTIVE("account-is-not-yet-active"),
159
160
161
162  /**
163   * The property whose value will be a generalized time representation of the
164   * activation time for the associated account, if available.  This will be
165   * available for all notification types, if the account has an activation
166   * time.
167   */
168  ACCOUNT_ACTIVATION_TIME("account-activation-time"),
169
170
171
172  /**
173   * The property whose value will be the number of seconds until the associated
174   * account becomes active.  This will be available for all notification types,
175   * if the account has an activation time in the future.
176   */
177  SECONDS_UNTIL_ACCOUNT_ACTIVATION("seconds-until-account-activation"),
178
179
180
181  /**
182   * The property whose value will be a localized, human-readable length of
183   * time until the associated account becomes active.  This will be available
184   * for all notification types, if the account has an activation time in the
185   * future.
186   */
187  TIME_UNTIL_ACCOUNT_ACTIVATION("time-until-account-activation"),
188
189
190
191  /**
192   * The property whose value will be the number of seconds since the associated
193   * account became active.  This will be available for all notification types,
194   * if the account has an activation time in the past.
195   */
196  SECONDS_SINCE_ACCOUNT_ACTIVATION("seconds-since-account-activation"),
197
198
199
200  /**
201   * The property whose value will be a localized, human-readable length of
202   * time since the associated account became active.  This will be available
203   * for all notification types, if the account has an activation time in the
204   * past.
205   */
206  TIME_SINCE_ACCOUNT_ACTIVATION("time-since-account-activation"),
207
208
209
210  /**
211   * The property whose value will be "true" if the associated account is
212   * expired, or "false" if the account either does not have an expiration time
213   * or that time is in the future.  This will be available for all notification
214   * types.
215   */
216  ACCOUNT_IS_EXPIRED("account-is-expired"),
217
218
219
220  /**
221   * The property whose value will be a generalized time representation of the
222   * expiration time for the associated account, if available.  This will be
223   * available for all notification types, if the account has an expiration
224   * time.
225   */
226  ACCOUNT_EXPIRATION_TIME("account-expiration-time"),
227
228
229
230  /**
231   * The property whose value will be the number of seconds until the associated
232   * account expires.  This will be available for all notification types, if the
233   * account has an expiration time in the future.
234   */
235  SECONDS_UNTIL_ACCOUNT_EXPIRATION("seconds-until-account-expiration"),
236
237
238
239  /**
240   * The property whose value will be a localized, human-readable length of
241   * time until the associated account expires.  This will be available for all
242   * notification types, if the account has an expiration time in the future.
243   */
244  TIME_UNTIL_ACCOUNT_EXPIRATION("time-until-account-expiration"),
245
246
247
248  /**
249   * The property whose value will be the number of seconds since the associated
250   * account expired.  This will be available for all notification types, if the
251   * account has an expiration time in the past.
252   */
253  SECONDS_SINCE_ACCOUNT_EXPIRATION("seconds-since-account-expiration"),
254
255
256
257  /**
258   * The property whose value will be a localized, human-readable length of
259   * time since the associated account expired.  This will be available for all
260   * notification types, if the account has an expiration  time in the past.
261   */
262  TIME_SINCE_ACCOUNT_EXPIRATION("time-since-account-expiration"),
263
264
265
266  /**
267   * The property whose value will be "true" if the associated account has been
268   * temporarily or permanently locked as a result of too many authentication
269   * failures, or "false" if the account is not failure-locked.  This will be
270   * available for all notification types.
271   */
272  ACCOUNT_IS_FAILURE_LOCKED("account-is-failure-locked"),
273
274
275
276  /**
277   * The property whose value will be a generalized time representation of the
278   * time that the account was locked as a result of too many authentication
279   * failures.  This will be available for all notification types, if the
280   * account is failure-locked.
281   */
282  FAILURE_LOCKED_TIME("failure-locked-time"),
283
284
285
286  /**
287   * The property whose value will be a generalized time representation of the
288   * time at which the user's account will be unlocked.  This will be available
289   * for all notification types, if an account is temporarily failure-locked.
290   */
291  ACCOUNT_UNLOCK_TIME("account-unlock-time"),
292
293
294
295  /**
296   * The property whose value will be the number of seconds until the user's
297   * account is unlocked.  This will be available for all notification types, if
298   * an account is temporarily failure-locked.
299   */
300  SECONDS_UNTIL_UNLOCK("seconds-until-unlock"),
301
302
303
304  /**
305   * The property whose value will be a localized, human-readable representation
306   * of the length of time until the user's account is unlocked.  This will be
307   * available for all notification types, if an account is temporarily
308   * failure-locked.
309   */
310  TIME_UNTIL_UNLOCK("time-until-unlock"),
311
312
313
314  /**
315   * The property whose value will be the number of failed authentication
316   * attempts required to lock an account.  This will be available for all
317   * notification types, if failure lockout is enabled.
318   */
319  FAILURE_LOCKOUT_COUNT("failure-lockout-count"),
320
321
322
323  /**
324   * The property whose value will be the number of seconds that an account will
325   * remain locked as a result of too many authentication failures.  This will
326   * be available for all notification types, if failure lockout is enabled with
327   * a lockout duration.
328   */
329  FAILURE_LOCKOUT_DURATION_SECONDS("failure-lockout-duration-seconds"),
330
331
332
333  /**
334   * The property whose value will be a localized, human-readable representation
335   * of the length of time that an account will remain locked as a result of too
336   * many authentication failures.  This will be available for all notification
337   * types, if failure lockout is enabled with a lockout duration.
338   */
339  FAILURE_LOCKOUT_DURATION("failure-lockout-duration"),
340
341
342
343  /**
344   * The property whose value will be "true" if the associated account has been
345   * locked because it has been too long since the last successful
346   * authentication, or "false" if the account is not idle-locked.  This will be
347   * available for all notification types.
348   */
349  ACCOUNT_IS_IDLE_LOCKED("account-is-idle-locked"),
350
351
352
353  /**
354   * The property whose value will be the maximum number of seconds that may
355   * pass between the last successful authentication on an account and that
356   * account becoming locked for lack of use.  This will be available for all
357   * notification types, if idle lockout is enabled.
358   */
359  IDLE_LOCKOUT_INTERVAL_SECONDS("idle-lockout-interval-seconds"),
360
361
362
363  /**
364   * The property whose value will be a localized, human-readable representation
365   * of the maximum length of time that may pass between the last successful
366   * authentication for an account and that account becoming locked for lack of
367   * use.  This will be available for all notification types, if idle lockout
368   * is enabled.
369   */
370  IDLE_LOCKOUT_INTERVAL("idle-lockout-interval"),
371
372
373
374  /**
375   * The property whose value will be a generalized time representation of the
376   * time that the user last successfully authenticated, if available.  This
377   * will be available for all notification types, if a last login time is
378   * available for the user.
379   */
380  LAST_LOGIN_TIME("last-login-time"),
381
382
383
384  /**
385   * The property whose value will be the number of seconds since the user last
386   * successfully authenticated, if available.  This will be available for all
387   * notification types, if a last login time is available for the user.
388   */
389  SECONDS_SINCE_LAST_LOGIN("seconds-since-last-login"),
390
391
392
393  /**
394   * The property whose value will be a localized, human-readable representation
395   * of the length of time since the user last successfully authenticated, if
396   * available.  This will be available for all notification types, if a last
397   * login time is available for the user.
398   */
399  TIME_SINCE_LAST_LOGIN("time-since-last-login"),
400
401
402
403  /**
404   * The property whose value will be the IP address of the client from which
405   * the user last successfully authenticated, if available.  This will be
406   * available for all notification types.
407   */
408  LAST_LOGIN_IP_ADDRESS("last-login-ip-address"),
409
410
411
412  /**
413   * The property whose value will be "true" if the associated account has been
414   * locked because the user failed to choose a new password in a timely manner
415   * after it was administratively reset, or "false" if the account is not
416   * reset-locked.  This will be available for all notification types.
417   */
418  ACCOUNT_IS_RESET_LOCKED("account-is-reset-locked"),
419
420
421
422  /**
423   * The property whose value will be the maximum number of seconds that a user
424   * has to change their password after an administrative reset before their
425   * account will become locked.  This will be available for all notification
426   * types, if reset lockout is enabled.
427   */
428  MAXIMUM_PASSWORD_RESET_AGE_SECONDS("maximum-password-reset-age-seconds"),
429
430
431
432  /**
433   * The property whose value will be a localized, human-readable representation
434   * of the maximum length of time that a user has to change their password
435   * after an administrative reset before their account will become locked.
436   * This will be available for all notification types, if reset lockout is
437   * enabled.
438   */
439  MAXIMUM_PASSWORD_RESET_AGE("maximum-password-reset-age"),
440
441
442
443  /**
444   * The property whose value will be "true" if the associated user must choose
445   * a new password before they will be permitted to request any other
446   * operations, or "false" if the user will not be required to change their
447   * password.
448   */
449  MUST_CHANGE_PASSWORD("must-change-password"),
450
451
452
453  /**
454   * The property whose value will be "true" if the associated account has been
455   * locked because it contains a password that did not satisfy all of the
456   * configured password validators, or "false" if the account is not
457   * validation-locked.  This will be available for all notification types.
458   */
459  ACCOUNT_IS_VALIDATION_LOCKED("account-is-validation-locked"),
460
461
462
463  /**
464   * The property whose value will be "true" if the associated account was
465   * unlocked by the associated operation, or "false" if it was not unlocked.
466   * This will be available for the
467   * {@link AccountStatusNotificationType#PASSWORD_RESET} and
468   * {@link AccountStatusNotificationType#PASSWORD_CHANGED} notification types.
469   */
470  ACCOUNT_WAS_UNLOCKED("account-was-unlocked"),
471
472
473
474  /**
475   * The property whose value will be "true" if the associated account has an
476   * expired password, or "false" if the password is not expired.  This will be
477   * available for all notification types.
478   */
479  PASSWORD_IS_EXPIRED("password-is-expired"),
480
481
482
483  /**
484   * The property whose value will be "true" if the associated account has a
485   * password that is about to expire, or "false" if the account does not have
486   * a password that is about to expire.  This will be available for all
487   * notification types.
488   */
489  PASSWORD_IS_EXPIRING("password-is-expiring"),
490
491
492
493  /**
494   * The property whose value will be the maximum length of time in seconds that
495   * an account will be permitted to continue using the same password before it
496   * will expire.  This will be available for all notification types, if
497   * password expiration is enabled.
498   */
499  MAXIMUM_PASSWORD_AGE_SECONDS("maximum-password-age-seconds"),
500
501
502
503  /**
504   * The property whose value will be a localized, human-readable representation
505   * of the maximum length of time that an account will be permitted to continue
506   * using the same password before it will expire.  This will be available for
507   * all notification types, if password expiration is enabled.
508   */
509  MAXIMUM_PASSWORD_AGE("maximum-password-age"),
510
511
512
513  /**
514   * The property whose value will be the generalized time representation of the
515   * time that the user's password will expire (if it is in the future) or that
516   * it did expire (if it was in the past).  This will be available for all
517   * notification types, if password expiration is enabled.
518   */
519  PASSWORD_EXPIRATION_TIME("password-expiration-time"),
520
521
522
523  /**
524   * The property whose value will be the number of seconds until the user's
525   * password expires (if it is in the future).  This will be available for all
526   * notification types, if there is an upcoming password expiration.
527   */
528  SECONDS_UNTIL_PASSWORD_EXPIRATION("seconds-until-password-expiration"),
529
530
531
532  /**
533   * The property whose value will be the number of seconds until the user's
534   * password expires (if it is in the future).  This will be available for all
535   * notification types, if there is an upcoming password expiration.
536   *
537   * @deprecated  Use {@link #SECONDS_UNTIL_PASSWORD_EXPIRATION} instead.
538   */
539  @Deprecated()
540  SECONDS_UNTIL_EXPIRATION("seconds-until-expiration"),
541
542
543
544  /**
545   * The property whose value will be a localized, human-readable representation
546   * of the length of time until the user's password expires (if it is in the
547   * future).  This will be available for all notification types, if there is an
548   * upcoming password expiration.
549   */
550  TIME_UNTIL_PASSWORD_EXPIRATION("time-until-password-expiration"),
551
552
553
554  /**
555   * The property whose value will be a localized, human-readable representation
556   * of the length of time until the user's password expires (if it is in the
557   * future).  This will be available for all notification types, if there is an
558   * upcoming password expiration.
559   *
560   * @deprecated  Use {@link #TIME_UNTIL_PASSWORD_EXPIRATION} instead.
561   */
562  @Deprecated()
563  TIME_UNTIL_EXPIRATION("time-until-expiration"),
564
565
566
567  /**
568   * The property whose value will be the number of seconds since the user's
569   * password expired (if it is in the past).  This will be available for all
570   * notification types, if there is an expired password.
571   */
572  SECONDS_SINCE_PASSWORD_EXPIRATION("seconds-since-password-expiration"),
573
574
575
576  /**
577   * The property whose value will be a localized, human-readable representation
578   * of the length of time since the user's password expired (if it is in the
579   * past).  This will be available for all notification types, if there is an
580   * expired password.
581   */
582  TIME_SINCE_PASSWORD_EXPIRATION("time-since-password-expiration"),
583
584
585
586  /**
587   * The property whose value will be a clear-text representation of the user's
588   * old password.  This may be (but is not guaranteed to be) available for the
589   * {@link AccountStatusNotificationType#PASSWORD_RESET} and
590   * {@link AccountStatusNotificationType#PASSWORD_CHANGED} notification types.
591   */
592  OLD_PASSWORD("old-password"),
593
594
595
596  /**
597   * The property whose value will be a clear-text representation of the user's
598   * new password.  This may be (but is not guaranteed to be) available for the
599   * {@link AccountStatusNotificationType#PASSWORD_RESET} and
600   * {@link AccountStatusNotificationType#PASSWORD_CHANGED} notification types.
601   */
602  NEW_PASSWORD("new-password"),
603
604
605
606  /**
607   * The property whose value will be a clear-text representation of the user's
608   * new password, but only if the new password was generated by the server
609   * rather than provided by the client.  This may be (but is not guaranteed to
610   * be) available for the
611   * {@link AccountStatusNotificationType#PASSWORD_RESET} and
612   * {@link AccountStatusNotificationType#PASSWORD_CHANGED} notification types.
613   */
614  NEW_GENERATED_PASSWORD("new-generated-password"),
615
616
617
618  /**
619   * The property whose value will be the IP address of the client that
620   * requested the associated operation.  This will be available for all
621   * notification types, if the request was initiated by an external client.
622   */
623  REQUESTER_IP_ADDRESS("requester-ip-address"),
624
625
626
627  /**
628   * The property whose value will be the DN of the authorization identity for
629   * the associated operation.  This will be available for all notification
630   * types.
631   */
632  REQUESTER_DN("requester-dn"),
633
634
635
636  /**
637   * The property whose value will be name of the operation type for the
638   * associated operation.  This will be available for all notification types.
639   */
640  OPERATION_TYPE("operation-type"),
641
642
643
644  /**
645   * The property whose value will be the operation ID for the associated
646   * operation.  This will be available for all notification types.
647   */
648  OPERATION_ID("operation-id"),
649
650
651
652  /**
653   * The property whose value will be the connection ID for the associated
654   * operation.  This will be available for all notification types.
655   */
656  CONNECTION_ID("connection-id"),
657
658
659
660  /**
661   * The property whose value will be the server UUID value for the server in
662   * which the notification was generated.  This will be available for all
663   * notification types.
664   */
665  SERVER_UUID("server-uuid"),
666
667
668
669  /**
670   * The property whose value will be the server instance name for the server in
671   * which the notification was generated.  This will be available for all
672   * notification types.
673   */
674  INSTANCE_NAME("instance-name"),
675
676
677
678  /**
679   * The property whose values will be human-readable messages describing
680   * why a provided password failed to satisfy one or more of the configured
681   * password validators.  This will be available for the
682   * {@link AccountStatusNotificationType#BIND_PASSWORD_FAILED_VALIDATION}
683   * notification type.
684   */
685  PASSWORD_VALIDATION_FAILURE_REASONS("password-validation-failure-reasons");
686
687
688
689  // The notification type name.
690  private final String name;
691
692
693
694  /**
695   * Creates a new account status notification property with the provided name.
696   *
697   * @param  name  The name for this account status notification property.
698   */
699  AccountStatusNotificationProperty(final String name)
700  {
701    this.name = name;
702  }
703
704
705
706  /**
707   * Retrieves the account status notification type with the specified name.
708   *
709   * @param  name  The name for the account status notification type to
710   *               retrieve.
711   *
712   * @return  The requested account status notification type, or {@code null}
713   *          if there is no type with the given name.
714   */
715  public static AccountStatusNotificationProperty forName(final String name)
716  {
717    final String lowerNameWithDashesInsteadOfUnderscores =
718         StaticUtils.toLowerCase(name).replace('_', '-');
719    for (final AccountStatusNotificationProperty p : values())
720    {
721      if (p.getName().equals(lowerNameWithDashesInsteadOfUnderscores))
722      {
723        return p;
724      }
725    }
726
727    return null;
728  }
729
730
731
732  /**
733   * Retrieves the name for this account status notification property.
734   *
735   * @return  The name for this account status notification property.
736   */
737  public String getName()
738  {
739    return name;
740  }
741
742
743
744  /**
745   * Retrieves a string representation of this account status
746   * notification property.
747   *
748   * @return  A string representation of this account status
749   *          notification property.
750   */
751  @Override()
752  public String toString()
753  {
754    return name;
755  }
756}
757