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.controls;
022
023
024
025import com.unboundid.util.ThreadSafety;
026import com.unboundid.util.ThreadSafetyLevel;
027
028
029
030/**
031 * This enum defines the set of response types that can be used in the
032 * password validation details response control.
033 * <BR>
034 * <BLOCKQUOTE>
035 *   <B>NOTE:</B>  This class, and other classes within the
036 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
037 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
038 *   server products.  These classes provide support for proprietary
039 *   functionality or for external specifications that are not considered stable
040 *   or mature enough to be guaranteed to work in an interoperable way with
041 *   other types of LDAP servers.
042 * </BLOCKQUOTE>
043 */
044@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
045public enum PasswordValidationDetailsResponseType
046{
047  /**
048   * The response type that indicates that the server was able to perform
049   * validation against the proposed password, and that the response includes
050   * a set of validation results.
051   */
052  VALIDATION_DETAILS((byte) 0xA0),
053
054
055
056  /**
057   * The response type that indicates that the server was unable to provide
058   * validation results because the associated request did not include any
059   * password.
060   */
061  NO_PASSWORD_PROVIDED((byte) 0x81),
062
063
064
065  /**
066   * The response type that indicates that the server was unable to provide
067   * validation results because the associated request included multiple
068   * passwords.
069   */
070  MULTIPLE_PASSWORDS_PROVIDED((byte) 0x82),
071
072
073
074  /**
075   * The response type that indicates that the server encountered a problem with
076   * the request that caused processing to end before any password validation
077   * was attempted.
078   */
079  NO_VALIDATION_ATTEMPTED((byte) 0x83);
080
081
082
083  // The BER type that will be used for this response type in an encoded
084  // password validation details response control.
085  private final byte berType;
086
087
088
089  /**
090   * Creates a new password validation details response type with the provided
091   * BER type.
092   *
093   * @param  berType  The BER type that will be used for this response type in
094   *                  an encoded password validation details response control.
095   */
096  PasswordValidationDetailsResponseType(final byte berType)
097  {
098    this.berType = berType;
099  }
100
101
102
103  /**
104   * Retrieves the BER type that will be used for this response type in an
105   * encoded password validation details response control.
106   *
107   * @return  The BER type that will be used for this response type in an
108   *          encoded password validation details response control.
109   */
110  public byte getBERType()
111  {
112    return berType;
113  }
114
115
116
117  /**
118   * Retrieves the password validation details response type with the specified
119   * BER type.
120   *
121   * @param  berType  The BER type for the password validation details response
122   *                  type to retrieve.
123   *
124   * @return  The password validation details response type with the specified
125   *          BER type, or {@code null} if there is no response type with the
126   *          specified BER type.
127   */
128  public static PasswordValidationDetailsResponseType
129                     forBERType(final byte berType)
130  {
131    for (final PasswordValidationDetailsResponseType t : values())
132    {
133      if (t.berType == berType)
134      {
135        return t;
136      }
137    }
138
139    return null;
140  }
141}