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.ldap.sdk.Control;
026 import com.unboundid.ldap.sdk.LDAPException;
027 import com.unboundid.ldap.sdk.ResultCode;
028 import com.unboundid.util.NotMutable;
029 import com.unboundid.util.ThreadSafety;
030 import com.unboundid.util.ThreadSafetyLevel;
031
032 import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
033
034
035
036 /**
037 * <BLOCKQUOTE>
038 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
039 * LDAP SDK for Java. It is not available for use in applications that
040 * include only the Standard Edition of the LDAP SDK, and is not supported for
041 * use in conjunction with non-UnboundID products.
042 * </BLOCKQUOTE>
043 * This class provides an implementation for a request control that can be
044 * included in an add, modify, or password modify request. Its presence in one
045 * of those requests will indicate that the server should provide a response
046 * control with information about the password quality requirements that are in
047 * effect for the operation and information about whether the password included
048 * in the request satisfies each of those requirements.
049 * <BR><BR>
050 * This request control has an OID of 1.3.6.1.4.1.30221.2.5.40, and it is
051 * recommended that the criticality be {@code false}. It does not have a value.
052 */
053 @NotMutable()
054 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
055 public final class PasswordValidationDetailsRequestControl
056 extends Control
057 {
058 /**
059 * The OID (1.3.6.1.4.1.30221.2.5.40) for the password validation details
060 * request control.
061 */
062 public static final String PASSWORD_VALIDATION_DETAILS_REQUEST_OID =
063 "1.3.6.1.4.1.30221.2.5.40";
064
065
066
067 /**
068 * The serial version UID for this serializable class.
069 */
070 private static final long serialVersionUID = -956099348044171899L;
071
072
073
074 /**
075 * Creates a new password validation details request control with
076 * a criticality of {@code false}.
077 */
078 public PasswordValidationDetailsRequestControl()
079 {
080 this(false);
081 }
082
083
084
085 /**
086 * Creates a new password validation details request control with the
087 * specified criticality.
088 *
089 * @param isCritical Indicates whether this control should be considered
090 * critical.
091 */
092 public PasswordValidationDetailsRequestControl(final boolean isCritical)
093 {
094 super(PASSWORD_VALIDATION_DETAILS_REQUEST_OID, isCritical, null);
095 }
096
097
098
099 /**
100 * Creates a new password validation details request control which is decoded
101 * from the provided generic control.
102 *
103 * @param control The generic control to be decoded as a password validation
104 * details request control.
105 *
106 * @throws LDAPException If the provided control cannot be decoded as a
107 * password validation details request control.
108 */
109 public PasswordValidationDetailsRequestControl(final Control control)
110 throws LDAPException
111 {
112 super(control);
113
114 if (control.hasValue())
115 {
116 throw new LDAPException(ResultCode.DECODING_ERROR,
117 ERR_PW_VALIDATION_REQUEST_HAS_VALUE.get());
118 }
119 }
120
121
122
123 /**
124 * {@inheritDoc}
125 */
126 @Override()
127 public String getControlName()
128 {
129 return INFO_CONTROL_NAME_PW_VALIDATION_REQUEST.get();
130 }
131
132
133
134 /**
135 * {@inheritDoc}
136 */
137 @Override()
138 public void toString(final StringBuilder buffer)
139 {
140 buffer.append("PasswordValidationDetailsRequestControl(isCritical=");
141 buffer.append(isCritical());
142 buffer.append(')');
143 }
144 }