001    /*
002     * Copyright 2015 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2015 UnboundID Corp.
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     */
021    package com.unboundid.ldap.sdk.unboundidds.extensions;
022    
023    
024    
025    import com.unboundid.util.ThreadSafety;
026    import com.unboundid.util.ThreadSafetyLevel;
027    
028    
029    
030    /**
031     * <BLOCKQUOTE>
032     *   <B>NOTE:</B>  This class is part of the Commercial Edition of the UnboundID
033     *   LDAP SDK for Java.  It is not available for use in applications that
034     *   include only the Standard Edition of the LDAP SDK, and is not supported for
035     *   use in conjunction with non-UnboundID products.
036     * </BLOCKQUOTE>
037     * This enum specifies the modes in which the get password quality requirements
038     * extended operation may determine the type of password update operation that
039     * will be performed and the way in which the server should determine which
040     * password policy to use in order to obtain the password quality requirements.
041     */
042    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
043    public enum GetPasswordQualityRequirementsTargetType
044    {
045      /**
046       * Indicates that the Directory Server should return the password quality
047       * requirements that the server's default password policy will impose for an
048       * add operation.
049       */
050      ADD_WITH_DEFAULT_PASSWORD_POLICY((byte) 0x80),
051    
052    
053    
054      /**
055       * Indicates that the Directory Server should return the password quality
056       * requirements that the server will impose for an add operation for an entry
057       * governed by a specific password policy.  The password policy will be
058       * identified by the DN of the entry containing the password policy
059       * definition.
060       */
061      ADD_WITH_SPECIFIED_PASSWORD_POLICY((byte) 0x81),
062    
063    
064    
065      /**
066       * Indicates that the Directory Server should return the password quality
067       * requirements that the server will impose for a self password change for
068       * the authorization identity used for the get password quality requirements
069       * extended request.
070       */
071      SELF_CHANGE_FOR_AUTHORIZATION_IDENTITY((byte) 0x82),
072    
073    
074    
075      /**
076       * Indicates that the Directory Server should return the password quality
077       * requirements that the server will impose for a self password change for a
078       * specific user, identified by DN.
079       */
080      SELF_CHANGE_FOR_SPECIFIED_USER((byte) 0x83),
081    
082    
083    
084      /**
085       * Indicates that the Directory Server should return the password quality
086       * requirements that the server will impose for an administrative password
087       * reset for a specific user, identified by DN.
088       */
089      ADMINISTRATIVE_RESET_FOR_SPECIFIED_USER((byte) 0x84);
090    
091    
092    
093      // The BER type that will be used for this target type in an encoded get
094      // password quality requirements extended request.
095      private final byte berType;
096    
097    
098    
099      /**
100       * Creates a new get password quality requirements target type with the
101       * specified BER type.
102       *
103       * @param  berType  The BER type that will be used for this target type in an
104       *                  encoded get password quality requirements extended
105       *                  request.
106       */
107      private GetPasswordQualityRequirementsTargetType(final byte berType)
108      {
109        this.berType = berType;
110      }
111    
112    
113    
114      /**
115       * Retrieves the BER type that will be used for this target type in an encoded
116       * get password quality requirements extended request.
117       *
118       * @return  The BER type that will be used for this target type in an encoded
119       *          get password quality requirements extended request.
120       */
121      public byte getBERType()
122      {
123        return berType;
124      }
125    
126    
127    
128      /**
129       * Retrieves the get password quality requirements target type with the
130       * specified BER type.
131       *
132       * @param  berType  The BER type for the target type to retrieve.
133       *
134       * @return  The get password quality requirements target type with the
135       *          specified BER type, or {@code null} if there is no target type
136       *          with the specified BER type.
137       */
138      public static GetPasswordQualityRequirementsTargetType forBERType(
139                         final byte berType)
140      {
141        for (final GetPasswordQualityRequirementsTargetType t : values())
142        {
143          if (t.berType == berType)
144          {
145            return t;
146          }
147        }
148    
149        return null;
150      }
151    }