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.controls;
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 defines the set of response types that can be used in the
038 * password validation details response control.
039 */
040 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
041 public enum PasswordValidationDetailsResponseType
042 {
043 /**
044 * The response type that indicates that the server was able to perform
045 * validation against the proposed password, and that the response includes
046 * a set of validation results.
047 */
048 VALIDATION_DETAILS((byte) 0xA0),
049
050
051
052 /**
053 * The response type that indicates that the server was unable to provide
054 * validation results because the associated request did not include any
055 * password.
056 */
057 NO_PASSWORD_PROVIDED((byte) 0x81),
058
059
060
061 /**
062 * The response type that indicates that the server was unable to provide
063 * validation results because the associated request included multiple
064 * passwords.
065 */
066 MULTIPLE_PASSWORDS_PROVIDED((byte) 0x82),
067
068
069
070 /**
071 * The response type that indicates that the server encountered a problem with
072 * the request that caused processing to end before any password validation
073 * was attempted.
074 */
075 NO_VALIDATION_ATTEMPTED((byte) 0x83);
076
077
078
079 // The BER type that will be used for this response type in an encoded
080 // password validation details response control.
081 private final byte berType;
082
083
084
085 /**
086 * Creates a new password validation details response type with the provided
087 * BER type.
088 *
089 * @param berType The BER type that will be used for this response type in
090 * an encoded password validation details response control.
091 */
092 private PasswordValidationDetailsResponseType(final byte berType)
093 {
094 this.berType = berType;
095 }
096
097
098
099 /**
100 * Retrieves the BER type that will be used for this response type in an
101 * encoded password validation details response control.
102 *
103 * @return The BER type that will be used for this response type in an
104 * encoded password validation details response control.
105 */
106 public byte getBERType()
107 {
108 return berType;
109 }
110
111
112
113 /**
114 * Retrieves the password validation details response type with the specified
115 * BER type.
116 *
117 * @param berType The BER type for the password validation details response
118 * type to retrieve.
119 *
120 * @return The password validation details response type with the specified
121 * BER type, or {@code null} if there is no response type with the
122 * specified BER type.
123 */
124 public static PasswordValidationDetailsResponseType
125 forBERType(final byte berType)
126 {
127 for (final PasswordValidationDetailsResponseType t : values())
128 {
129 if (t.berType == berType)
130 {
131 return t;
132 }
133 }
134
135 return null;
136 }
137 }