001/*
002 * Copyright 2020 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2020 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2020 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds;
037
038
039
040import com.unboundid.util.Debug;
041import com.unboundid.util.NotNull;
042import com.unboundid.util.Nullable;
043import com.unboundid.util.StaticUtils;
044
045
046
047/**
048 * This enum defines the set of fields that are supported for use with the
049 * {@link PasswordPolicyStateJSON} object.
050 * <BR>
051 * <BLOCKQUOTE>
052 *   <B>NOTE:</B>  This class, and other classes within the
053 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
054 *   supported for use against Ping Identity, UnboundID, and
055 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
056 *   for proprietary functionality or for external specifications that are not
057 *   considered stable or mature enough to be guaranteed to work in an
058 *   interoperable way with other types of LDAP servers.
059 * </BLOCKQUOTE>
060 */
061public enum PasswordPolicyStateJSONField
062{
063  /**
064   * The field used to hold the DN of the user's password policy.
065   */
066  PASSWORD_POLICY_DN("password-policy-dn"),
067
068
069
070  /**
071   * The field used to indicate whether the user's account is considered usable.
072   */
073  ACCOUNT_IS_USABLE("account-is-usable"),
074
075
076
077  /**
078   * The field used to hold information about any account usability errors.
079   */
080  ACCOUNT_USABILITY_ERRORS("account-usability-errors"),
081
082
083
084  /**
085   * The field used to hold information about any account usability warnings.
086   */
087  ACCOUNT_USABILITY_WARNINGS("account-usability-warnings"),
088
089
090
091  /**
092   * The field used to hold information about any account usability notices.
093   */
094  ACCOUNT_USABILITY_NOTICES("account-usability-notices"),
095
096
097
098  /**
099   * The JSON field used to indicate whether the user has a static password.
100   */
101  HAS_STATIC_PASSWORD("has-static-password"),
102
103
104
105  /**
106   * The field used to hold the time the user's password was last changed.
107   */
108  PASSWORD_CHANGED_TIME("password-changed-time"),
109
110
111
112  /**
113   * The field used to hold the length of time in seconds since the user's
114   * password was last changed.
115   */
116  SECONDS_SINCE_PASSWORD_CHANGE("seconds-since-password-change"),
117
118
119
120  /**
121   * The field used to indicate whether the user's account has been
122   * administratively disabled.
123   */
124  ACCOUNT_IS_DISABLED("account-is-disabled"),
125
126
127
128  /**
129   * The field used to indicate whether the user's account is not yet active.
130   */
131  ACCOUNT_IS_NOT_YET_ACTIVE(
132       "account-is-not-yet-active"),
133
134
135
136  /**
137   * The field used to hold the time that the user's account will become active.
138   */
139  ACCOUNT_ACTIVATION_TIME("account-activation-time"),
140
141
142
143  /**
144   * The field used to hold the length of time in seconds until the user's
145   * account will become active.
146   */
147  SECONDS_UNTIL_ACCOUNT_ACTIVATION("seconds-until-account-activation"),
148
149
150
151  /**
152   * The field used to hold the length of time in seconds since the user's
153   * account became active.
154   */
155  SECONDS_SINCE_ACCOUNT_ACTIVATION("seconds-since-account-activation"),
156
157
158
159  /**
160   * The field used to indicate whether the user's account is expired.
161   */
162  ACCOUNT_IS_EXPIRED("account-is-expired"),
163
164
165
166  /**
167   * The field used to hold the time that the user's account will expire.
168   */
169  ACCOUNT_EXPIRATION_TIME("account-expiration-time"),
170
171
172
173  /**
174   * The field used to hold the length of time in seconds until the user's
175   * account will expire.
176   */
177  SECONDS_UNTIL_ACCOUNT_EXPIRATION("seconds-until-account-expiration"),
178
179
180
181  /**
182   * The JSON field used to hold the length of time in seconds since the user's
183   * account expired.
184   */
185  SECONDS_SINCE_ACCOUNT_EXPIRATION("seconds-since-account-expiration"),
186
187
188
189  /**
190   * The field used to indicate whether the user's password is expired.
191   */
192  PASSWORD_IS_EXPIRED("password-is-expired"),
193
194
195
196  /**
197   * The field used to hold the maximum length of time in seconds that the user
198   * can keep the same password before it expires.
199   */
200  MAXIMUM_PASSWORD_AGE_SECONDS("maximum-password-age-seconds"),
201
202
203
204  /**
205   * The field used to hold the time the user's password will (or did) expire.
206   */
207  PASSWORD_EXPIRATION_TIME("password-expiration-time"),
208
209
210
211  /**
212   * The field used to hold the length of time in seconds until the user's
213   * password will expire.
214   */
215  SECONDS_UNTIL_PASSWORD_EXPIRATION("seconds-until-password-expiration"),
216
217
218
219  /**
220   * The field used to hold the length of time in seconds since the user's
221   * password expired.
222   */
223  SECONDS_SINCE_PASSWORD_EXPIRATION("seconds-since-password-expiration"),
224
225
226
227  /**
228   * The field used to hold the length of time before the user's password
229   * expires that they will be eligible to receive a warning about the upcoming
230   * expiration.
231   */
232  PASSWORD_EXPIRATION_WARNING_INTERVAL_SECONDS(
233       "password-expiration-warning-interval-seconds"),
234
235
236
237  /**
238   * The field used to indicate whether the server may expire a user's password
239   * with issuing at least warning about the upcoming expiration.
240   */
241  EXPIRE_PASSWORDS_WITHOUT_WARNING("expire-passwords-without-warning"),
242
243
244
245  /**
246   * The field used to indicate whether the user has been warned about an
247   * upcoming password expiration.
248   */
249  PASSWORD_EXPIRATION_WARNING_ISSUED("password-expiration-warning-issued"),
250
251
252
253  /**
254   * The field used to hold the time that the user will be eligible to receive
255   * (or first received) a warning about an upcoming password expiration.
256   */
257  PASSWORD_EXPIRATION_WARNING_TIME("password-expiration-warning-time"),
258
259
260
261  /**
262   * The field used to hold the length of time in seconds until the user is
263   * eligible to be warned about an upcoming password expiration.
264   */
265  SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING(
266       "seconds-until-password-expiration-warning"),
267
268
269
270  /**
271   * The field used to hold the length of time in seconds since the user was
272   * first warned about an upcoming password expiration.
273   */
274  SECONDS_SINCE_PASSWORD_EXPIRATION_WARNING(
275       "seconds-since-password-expiration-warning"),
276
277
278
279  /**
280   * The field used to indicate whether the user's account is currently locked
281   * as a result of too many failed authentication attempts.
282   */
283  ACCOUNT_IS_FAILURE_LOCKED("account-is-failure-locked"),
284
285
286
287  /**
288   * The field used to hold the number of failed authentication attempts
289   * required to lock an account.
290   */
291  FAILURE_LOCKOUT_COUNT("failure-lockout-count"),
292
293
294
295  /**
296   * The field used to hold the user's current authentication failure
297   * count.
298   */
299  CURRENT_AUTHENTICATION_FAILURE_COUNT("current-authentication-failure-count"),
300
301
302
303  /**
304   * The field used to hold the remaining number of failed authentication
305   * attempts before the user's account will be locked.
306   */
307  REMAINING_AUTHENTICATION_FAILURE_COUNT(
308       "remaining-authentication-failure-count"),
309
310
311
312  /**
313   * The field used to hold the times of the outstanding failed authentication
314   * attempts.
315   */
316  AUTHENTICATION_FAILURE_TIMES("authentication-failure-times"),
317
318
319
320  /**
321   * The field used to hold the time the user's account was locked as a result
322   * of too many failed authentication attempts.
323   */
324  FAILURE_LOCKOUT_TIME("failure-lockout-time"),
325
326
327
328  /**
329   * The field used to hold the length of time in seconds that an account will
330   * remain locked as a result of too many failed authentication attempts.
331   */
332  FAILURE_LOCKOUT_DURATION_SECONDS("failure-lockout-duration-seconds"),
333
334
335
336  /**
337   * The field used to hold the time the user's failure-locked account will be
338   * automatically unlocked.
339   */
340  FAILURE_LOCKOUT_EXPIRATION_TIME("failure-lockout-expiration-time"),
341
342
343
344  /**
345   * The field used to hold the length of time in seconds until the user's
346   * failure-locked account will remain locked.
347   */
348  SECONDS_REMAINING_IN_FAILURE_LOCKOUT("seconds-remaining-in-failure-lockout"),
349
350
351
352  /**
353   * The field used to hold the time the user last authenticated to the server.
354   */
355  LAST_LOGIN_TIME("last-login-time"),
356
357
358
359  /**
360   * The field used to hold the length of time in seconds that has passed since
361   * the user last authenticated.
362   */
363  SECONDS_SINCE_LAST_LOGIN("seconds-since-last-login"),
364
365
366
367  /**
368   * The field used to hold the IP address of the client from which the user
369   * last authenticated.
370   */
371  LAST_LOGIN_IP_ADDRESS("last-login-ip-address"),
372
373
374
375  /**
376   * The field used to indicate whether the user's account is currently locked
377   * because it has been too long since they authenticated.
378   */
379  ACCOUNT_IS_IDLE_LOCKED("account-is-idle-locked"),
380
381
382
383  /**
384   * The field used to hold the maximum length of time in seconds that may pass
385   * between successful authentications before the user's account will be
386   * locked.
387   */
388  IDLE_LOCKOUT_INTERVAL_SECONDS("idle-lockout-interval-seconds"),
389
390
391
392  /**
393   * The field used to hold the time that the user's account will be (or was)
394   * locked for allowing too much time to pass between successful
395   * authentications.
396   */
397  IDLE_LOCKOUT_TIME("idle-lockout-time"),
398
399
400
401  /**
402   * The field used to hold the length of time in seconds until the user's
403   * account will be locked for allowing too much time to pass between
404   * successful authentications.
405   */
406  SECONDS_UNTIL_IDLE_LOCKOUT("seconds-until-idle-lockout"),
407
408
409
410  /**
411   * The field used to hold the length of time in seconds since the user's
412   * account was locked for allowing too much time to pass between successful
413   * authentications.
414   */
415  SECONDS_SINCE_IDLE_LOCKOUT("seconds-since-idle-lockout"),
416
417
418
419  /**
420   * The field used to indicate whether the user must change their password
421   * before they will be permitted to request any other operations in the
422   * server.
423   */
424  MUST_CHANGE_PASSWORD("must-change-password"),
425
426
427
428  /**
429   * The field used to indicate whether the user's account is currently locked
430   * because they failed to choose a new password in a timely manner after an
431   * administrative reset.
432   */
433  ACCOUNT_IS_RESET_LOCKED("account-is-reset-locked"),
434
435
436
437  /**
438   * The field used to indicate whether the user's password policy requires them
439   * to choose a new password the first time they authenticate after their
440   * account is created.
441   */
442  FORCE_CHANGE_ON_ADD("force-change-on-add"),
443
444
445
446  /**
447   * The field used to indicate whether the user's password policy requires them
448   * to choose a new password the first time they authenticate after their
449   * password is reset by an administrator.
450   */
451  FORCE_CHANGE_ON_RESET("force-change-on-reset"),
452
453
454
455  /**
456   * The field used to hold the maximum length of time in seconds that the user
457   * has to choose a new password after their account has been reset by an
458   * administrator before it will be locked.
459   */
460  MAXIMUM_PASSWORD_RESET_AGE_SECONDS("maximum-password-reset-age-seconds"),
461
462
463
464  /**
465   * The field used to hold the time at which the user's account will be locked
466   * if they do not choose a new password following an administrative reset.
467   */
468  RESET_LOCKOUT_TIME("reset-lockout-time"),
469
470
471
472  /**
473   * The field used to hold the length of time in seconds until the user's
474   * account will be locked if they do not choose a new password following an
475   * administrative reset.
476   */
477  SECONDS_UNTIL_RESET_LOCKOUT("seconds-until-reset-lockout"),
478
479
480
481  /**
482   * The field used to hold the maximum number of passwords that the server will
483   * retain in the password history.
484   */
485  MAXIMUM_PASSWORD_HISTORY_COUNT("maximum-password-history-count"),
486
487
488
489  /**
490   * The field used to hold the maximum length of time in seconds that the
491   * server will retain passwords in the password history.
492   */
493  MAXIMUM_PASSWORD_HISTORY_DURATION_SECONDS(
494       "maximum-password-history-duration-seconds"),
495
496
497
498  /**
499   * The field used to hold the number of passwords currently held in the user's
500   * password history.
501   */
502  CURRENT_PASSWORD_HISTORY_COUNT("current-password-history-count"),
503
504
505
506  /**
507   * The field used to indicate whether the user is not permitted to change
508   * their password because they are within the minimum password age.
509   */
510  IS_WITHIN_MINIMUM_PASSWORD_AGE("is-within-minimum-password-age"),
511
512
513
514  /**
515   * The field used to hold the minimum length of time in seconds that must pass
516   * between the time a user changes their password and the time they will be
517   * allowed to change it again.
518   */
519  MINIMUM_PASSWORD_AGE_SECONDS("minimum-password-age-seconds"),
520
521
522
523  /**
524   * The field used to hold the earliest time that the user will be permitted to
525   * change their password following an earlier password change.
526   */
527  MINIMUM_PASSWORD_AGE_EXPIRATION_TIME("minimum-password-age-expiration-time"),
528
529
530
531  /**
532   * The field used to hold the length of time in seconds that must pass before
533   * the user will be allowed to change their password following an earlier
534   * password change.
535   */
536  SECONDS_REMAINING_IN_MINIMUM_PASSWORD_AGE(
537       "seconds-remaining-in-minimum-password-age"),
538
539
540
541  /**
542   * The field used to hold the maximum number of grace login attempts that a
543   * user may have to change their password after it has expired.
544   */
545  MAXIMUM_GRACE_LOGIN_COUNT("maximum-grace-login-count"),
546
547
548
549  /**
550   * The field used to hold the number of grace logins that the user has
551   * currently used.
552   */
553  USED_GRACE_LOGIN_COUNT("used-grace-login-count"),
554
555
556
557  /**
558   * The field used to hold the number of remaining grace logins that the user
559   * has.
560   */
561  REMAINING_GRACE_LOGIN_COUNT("remaining-grace-login-count"),
562
563
564
565  /**
566   * The field used to hold the times that the user has used a grace login to
567   * authenticate.
568   */
569  GRACE_LOGIN_USE_TIMES("grace-login-use-times"),
570
571
572
573  /**
574   * The field used to indicate whether the user's account currently has a valid
575   * retired password.
576   */
577  HAS_RETIRED_PASSWORD("has-retired-password"),
578
579
580
581  /**
582   * The field used to hold the time that the user's retired password will
583   * expire.
584   */
585  RETIRED_PASSWORD_EXPIRATION_TIME("retired-password-expiration-time"),
586
587
588
589  /**
590   * The field used to hold the length of time in seconds remaining until the
591   * user's retired password will expire.
592   */
593  SECONDS_UNTIL_RETIRED_PASSWORD_EXPIRATION(
594       "seconds-until-retired-password-expiration"),
595
596
597
598  /**
599   * The field used to indicate whether the user is required to authenticate in
600   * a secure manner so that their credentials are not exposed to a third-party
601   * observer.
602   */
603  REQUIRE_SECURE_AUTHENTICATION("require-secure-authentication"),
604
605
606
607  /**
608   * The field used to indicate whether the user is required to change their
609   * password in a secure manner that does not expose the credentials to a
610   * third-party observer.
611   */
612  REQUIRE_SECURE_PASSWORD_CHANGES("require-secure-password-changes"),
613
614
615
616  /**
617   * The field used to hold the names of the SASL mechanisms that the user can
618   * use to authenticate.
619   */
620  AVAILABLE_SASL_MECHANISMS("available-sasl-mechanisms"),
621
622
623
624  /**
625   * The field used to hold the names of the one-time password delivery
626   * mechanisms that can be used to deliver one-time passwords, password reset
627   * tokens, or single-use tokens to the user.
628   */
629  AVAILABLE_OTP_DELIVERY_MECHANISMS("available-otp-delivery-mechanisms"),
630
631
632
633  /**
634   * The field used to indicate whether the user has any TOTP shared secrets
635   * registered with the server.
636   */
637  HAS_TOTP_SHARED_SECRET("has-totp-shared-secret"),
638
639
640
641  /**
642   * The field used to indicate whether the user has any YubiKey OTP devices
643   * registered with the server.
644   */
645  HAS_REGISTERED_YUBIKEY_OTP_DEVICE("has-registered-yubikey-otp-device"),
646
647
648
649  /**
650   * The field used to indicate whether the user's account is currently locked
651   * because it contains a password that does not satisfy all of the configured
652   * password validators.
653   */
654  ACCOUNT_IS_VALIDATION_LOCKED("account-is-validation-locked"),
655
656
657
658  /**
659   * The field used to hold the most recent time that password validation was
660   * performed during a bind operation for the user.
661   */
662  LAST_BIND_PASSWORD_VALIDATION_TIME("last-bind-password-validation-time"),
663
664
665
666  /**
667   * The field used to hold the length of time in seconds since the most recent
668   * time that password validation was performed during a bind operation for the
669   * user.
670   */
671  SECONDS_SINCE_LAST_BIND_PASSWORD_VALIDATION(
672       "seconds-since-last-bind-password-validation"),
673
674
675
676  /**
677   * The field used to hold the minimum length of time that should pass between
678   * invoking password validators during a bind operation for the user.
679   */
680  MINIMUM_BIND_PASSWORD_VALIDATION_FREQUENCY_SECONDS(
681       "minimum-bind-password-validation-frequency-seconds"),
682
683
684
685  /**
686   * The field used to indicate the action that the server should take if the
687   * bind password does not satisfy all of the configured password validators.
688   */
689  BIND_PASSWORD_VALIDATION_FAILURE_ACTION(
690       "bind-password-validation-failure-action"),
691
692
693
694  /**
695   * The field used to provide an encoded representation of the user's recent
696   * login history.
697   */
698  RECENT_LOGIN_HISTORY("recent-login-history"),
699
700
701
702  /**
703   * The field used to hold the maximum number of recent successful login
704   * attempts the server should maintain for a user.
705   */
706  MAXIMUM_RECENT_LOGIN_HISTORY_SUCCESSFUL_AUTHENTICATION_COUNT(
707       "maximum-recent-login-history-successful-authentication-count"),
708
709
710
711  /**
712   * The field used to hold the maximum age in seconds of recent successful
713   * login attempts the server should maintain for a user.
714   */
715  MAXIMUM_RECENT_LOGIN_HISTORY_SUCCESSFUL_AUTHENTICATION_DURATION_SECONDS(
716       "maximum-recent-login-history-successful-authentication-duration-" +
717            "seconds"),
718
719
720
721  /**
722   * The field used to hold the maximum number of recent failed login attempts
723   * the server should maintain for a user.
724   */
725  MAXIMUM_RECENT_LOGIN_HISTORY_FAILED_AUTHENTICATION_COUNT(
726       "maximum-recent-login-history-failed-authentication-count"),
727
728
729
730  /**
731   * The field used to hold the maximum age in seconds of recent failed login
732   * attempts the server should maintain for a user.
733   */
734  MAXIMUM_RECENT_LOGIN_HISTORY_FAILED_AUTHENTICATION_DURATION_SECONDS(
735       "maximum-recent-login-history-failed-authentication-duration-seconds"),
736
737
738
739  /**
740   * The field used to hold information about the requirements that passwords
741   * will be required to satisfy.
742   */
743  PASSWORD_QUALITY_REQUIREMENTS("password-quality-requirements");
744
745
746
747  // The name for the JSON field.
748  @NotNull private final String fieldName;
749
750
751
752  /**
753   * Creates a new password policy state JSON field with the specified name.
754   *
755   * @param  fieldName  The name for the JSON field.
756   */
757  PasswordPolicyStateJSONField(@NotNull final String fieldName)
758  {
759    this.fieldName = fieldName;
760  }
761
762
763
764  /**
765   * Retrieves the name for the JSON field.
766   *
767   * @return  The name for the JSON field.
768   */
769  @NotNull()
770  public String getFieldName()
771  {
772    return fieldName;
773  }
774
775
776
777  /**
778   * Retrieves the password policy state JSON field value with the specified
779   * name.
780   *
781   * @param  name  The name of the password policy state JSON field value to
782   *               retrieve.  It must not be {@code null}.
783   *
784   * @return  The password policy state JSON field value with the specified
785   *          name, or {@code null} if there is no value with the specified
786   *          name.
787   */
788  @Nullable()
789  public static PasswordPolicyStateJSONField forName(@NotNull final String name)
790  {
791    try
792    {
793      final String transformedName =
794           StaticUtils.toUpperCase(name).replace('-', '_');
795      return valueOf(transformedName);
796    }
797    catch (final Exception e)
798    {
799      Debug.debugException(e);
800      return null;
801    }
802  }
803
804
805
806  /**
807   * Retrieves a string representation of this password policy state JSON field.
808   *
809   * @return  A string representation of this password policy state JSON field.
810   */
811  @Override()
812  @NotNull()
813  public String toString()
814  {
815    return fieldName;
816  }
817}