001/*
002 * Copyright 2015-2017 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2017 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.extensions;
022
023
024
025import com.unboundid.util.ThreadSafety;
026import com.unboundid.util.ThreadSafetyLevel;
027
028
029
030/**
031 * This enum specifies the modes in which the get password quality requirements
032 * extended operation may determine the type of password update operation that
033 * will be performed and the way in which the server should determine which
034 * password policy to use in order to obtain the password quality requirements.
035 * <BR>
036 * <BLOCKQUOTE>
037 *   <B>NOTE:</B>  This class, and other classes within the
038 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
039 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
040 *   server products.  These classes provide support for proprietary
041 *   functionality or for external specifications that are not considered stable
042 *   or mature enough to be guaranteed to work in an interoperable way with
043 *   other types of LDAP servers.
044 * </BLOCKQUOTE>
045 */
046@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
047public enum GetPasswordQualityRequirementsTargetType
048{
049  /**
050   * Indicates that the Directory Server should return the password quality
051   * requirements that the server's default password policy will impose for an
052   * add operation.
053   */
054  ADD_WITH_DEFAULT_PASSWORD_POLICY((byte) 0x80),
055
056
057
058  /**
059   * Indicates that the Directory Server should return the password quality
060   * requirements that the server will impose for an add operation for an entry
061   * governed by a specific password policy.  The password policy will be
062   * identified by the DN of the entry containing the password policy
063   * definition.
064   */
065  ADD_WITH_SPECIFIED_PASSWORD_POLICY((byte) 0x81),
066
067
068
069  /**
070   * Indicates that the Directory Server should return the password quality
071   * requirements that the server will impose for a self password change for
072   * the authorization identity used for the get password quality requirements
073   * extended request.
074   */
075  SELF_CHANGE_FOR_AUTHORIZATION_IDENTITY((byte) 0x82),
076
077
078
079  /**
080   * Indicates that the Directory Server should return the password quality
081   * requirements that the server will impose for a self password change for a
082   * specific user, identified by DN.
083   */
084  SELF_CHANGE_FOR_SPECIFIED_USER((byte) 0x83),
085
086
087
088  /**
089   * Indicates that the Directory Server should return the password quality
090   * requirements that the server will impose for an administrative password
091   * reset for a specific user, identified by DN.
092   */
093  ADMINISTRATIVE_RESET_FOR_SPECIFIED_USER((byte) 0x84);
094
095
096
097  // The BER type that will be used for this target type in an encoded get
098  // password quality requirements extended request.
099  private final byte berType;
100
101
102
103  /**
104   * Creates a new get password quality requirements target type with the
105   * specified BER type.
106   *
107   * @param  berType  The BER type that will be used for this target type in an
108   *                  encoded get password quality requirements extended
109   *                  request.
110   */
111  GetPasswordQualityRequirementsTargetType(final byte berType)
112  {
113    this.berType = berType;
114  }
115
116
117
118  /**
119   * Retrieves the BER type that will be used for this target type in an encoded
120   * get password quality requirements extended request.
121   *
122   * @return  The BER type that will be used for this target type in an encoded
123   *          get password quality requirements extended request.
124   */
125  public byte getBERType()
126  {
127    return berType;
128  }
129
130
131
132  /**
133   * Retrieves the get password quality requirements target type with the
134   * specified BER type.
135   *
136   * @param  berType  The BER type for the target type to retrieve.
137   *
138   * @return  The get password quality requirements target type with the
139   *          specified BER type, or {@code null} if there is no target type
140   *          with the specified BER type.
141   */
142  public static GetPasswordQualityRequirementsTargetType forBERType(
143                     final byte berType)
144  {
145    for (final GetPasswordQualityRequirementsTargetType t : values())
146    {
147      if (t.berType == berType)
148      {
149        return t;
150      }
151    }
152
153    return null;
154  }
155}