001/*
002 * Copyright 2015-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 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.ldap.sdk.Control;
026import com.unboundid.ldap.sdk.LDAPException;
027import com.unboundid.ldap.sdk.ResultCode;
028import com.unboundid.util.NotMutable;
029import com.unboundid.util.ThreadSafety;
030import com.unboundid.util.ThreadSafetyLevel;
031
032import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
033
034
035
036/**
037 * This class provides an implementation of a request control that can be
038 * included in a bind request to indicate that the server should include a
039 * control in the bind response with information about any password policy state
040 * notices, warnings, and/or errors for the user.
041 * <BR>
042 * <BLOCKQUOTE>
043 *   <B>NOTE:</B>  This class, and other classes within the
044 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
045 *   supported for use against Ping Identity, UnboundID, and
046 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
047 *   for proprietary functionality or for external specifications that are not
048 *   considered stable or mature enough to be guaranteed to work in an
049 *   interoperable way with other types of LDAP servers.
050 * </BLOCKQUOTE>
051 * <BR>
052 * This control has an OID of 1.3.6.1.4.1.30221.2.5.46 and no value.  It must
053 * only be used in a bind request that also includes the
054 * {@link RetainIdentityRequestControl}, and the authentication identify of the
055 * connection prior to sending the bind request must have the
056 * permit-get-password-policy-state-issues privilege.
057 */
058@NotMutable()
059@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
060public final class GetPasswordPolicyStateIssuesRequestControl
061       extends Control
062{
063  /**
064   * The OID (1.3.6.1.4.1.30221.2.5.46) for the get password policy state issues
065   * request control.
066   */
067  public static final  String GET_PASSWORD_POLICY_STATE_ISSUES_REQUEST_OID =
068       "1.3.6.1.4.1.30221.2.5.46";
069
070
071
072  /**
073   * The serial version UID for this serializable class.
074   */
075  private static final long serialVersionUID = 5423754545363349200L;
076
077
078
079  /**
080   * Creates a new instance of this control.  It will not be considered
081   * critical.
082   */
083  public GetPasswordPolicyStateIssuesRequestControl()
084  {
085    this(false);
086  }
087
088
089
090  /**
091   * Creates a new instance of this control with the specified criticality.
092   *
093   * @param  isCritical  Indicates whether the control should be considered
094   *                     critical.
095   */
096  public GetPasswordPolicyStateIssuesRequestControl(final boolean isCritical)
097  {
098    super(GET_PASSWORD_POLICY_STATE_ISSUES_REQUEST_OID, isCritical);
099  }
100
101
102
103  /**
104   * Creates a new instance of this control that is decoded from the provided
105   * generic control.
106   *
107   * @param  control  The control to decode as a get password policy state
108   *                  issues request control.
109   *
110   * @throws LDAPException  If a problem is encountered while attempting to
111   *                         decode the provided control as a get password
112   *                         policy state issues request control.
113   */
114  public GetPasswordPolicyStateIssuesRequestControl(final Control control)
115         throws LDAPException
116  {
117    super(control);
118
119    if (control.hasValue())
120    {
121      throw new LDAPException(ResultCode.DECODING_ERROR,
122           ERR_GET_PWP_STATE_ISSUES_REQUEST_HAS_VALUE.get());
123    }
124  }
125
126
127
128  /**
129   * {@inheritDoc}
130   */
131  @Override()
132  public String getControlName()
133  {
134    return INFO_CONTROL_NAME_GET_PWP_STATE_ISSUES_REQUEST.get();
135  }
136
137
138
139  /**
140   * {@inheritDoc}
141   */
142  @Override()
143  public void toString(final StringBuilder buffer)
144  {
145    buffer.append("GetPasswordPolicyStateIssuesRequestControl(isCritical=");
146    buffer.append(isCritical());
147    buffer.append(')');
148  }
149}