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