Relax Control per OpenLDAP draft req'd for certain password policy operations in OpenLDAP 2.5
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/relax/RelaxControl.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/relax/RelaxControl.java
new file mode 100644
index 0000000..a71b4c6
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/relax/RelaxControl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.api.ldap.extras.controls.relax;
+
+
+import org.apache.directory.api.ldap.model.message.Control;
+
+/**
+ * The Relax {@link Control} interface.
+ * The LDAP Relax Rules Control. It's defined in https://tools.ietf.org/html/draft-zeilenga-ldap-relax-03.
+ * This control is sent with every update of pwdPolicySubEntry, pwdAccountLockedTime and pwdReset on user entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface RelaxControl extends Control
+{
+ /** The LDAP Relax Rules Control OID */
+ String OID = "1.3.6.1.4.1.4203.666.5.12";
+
+ String getOID();
+}
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/relax/RelaxControlImpl.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/relax/RelaxControlImpl.java
new file mode 100644
index 0000000..52d260d
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/relax/RelaxControlImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.api.ldap.extras.controls.relax;
+
+import org.apache.directory.api.ldap.model.message.controls.AbstractControl;
+
+/**
+ * The LDAP Relax Rules Control. It's defined in https://tools.ietf.org/html/draft-zeilenga-ldap-relax-03.
+ * This control is sent with every update of pwdPolicySubEntry, pwdAccountLockedTime and pwdReset on user entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class RelaxControlImpl extends AbstractControl implements RelaxControl
+{
+ public RelaxControlImpl()
+ {
+ super( OID );
+ }
+
+ public RelaxControlImpl( boolean isCritical )
+ {
+ super( OID );
+ this.setCritical( isCritical );
+ }
+
+ public String getOID()
+ {
+ return OID;
+ }
+}
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasCodecFactoryUtil.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasCodecFactoryUtil.java
index 0114ca8..8472b09 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasCodecFactoryUtil.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasCodecFactoryUtil.java
@@ -69,6 +69,8 @@
import org.apache.directory.api.ldap.extras.extended.ads_impl.startTls.StartTlsFactory;
import org.apache.directory.api.ldap.extras.extended.ads_impl.startTransaction.StartTransactionFactory;
import org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure.StoredProcedureFactory;
+import org.apache.directory.api.ldap.extras.controls.relax.RelaxControl;
+import org.apache.directory.api.ldap.extras.controls.relax_impl.RelaxControlFactory;
import org.apache.directory.api.ldap.extras.extended.ads_impl.whoAmI.WhoAmIFactory;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl_impl.SyncInfoValueFactory;
import org.apache.directory.api.ldap.model.message.Control;
@@ -76,6 +78,7 @@
import org.slf4j.LoggerFactory;
+
/**
* A utility class for adding Codec and extended operation factories.
*
@@ -246,6 +249,15 @@
{
LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, virtualListViewResponseFactory.getOid() ) );
}
+
+ // RelaxControl
+ ControlFactory<RelaxControl> relaxControlFactory = new RelaxControlFactory( apiService );
+ requestControlFactories.put( relaxControlFactory.getOid(), relaxControlFactory );
+
+ if ( LOG.isInfoEnabled() )
+ {
+ LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, relaxControlFactory.getOid() ) );
+ }
}
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/relax_impl/RelaxControlFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/relax_impl/RelaxControlFactory.java
new file mode 100644
index 0000000..529fd58
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/relax_impl/RelaxControlFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.api.ldap.extras.controls.relax_impl;
+
+
+import org.apache.directory.api.ldap.codec.api.AbstractControlFactory;
+import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.extras.controls.relax.RelaxControl;
+import org.apache.directory.api.ldap.extras.controls.relax.RelaxControlImpl;
+
+
+public class RelaxControlFactory extends AbstractControlFactory<RelaxControl>
+{
+ /**
+ * Creates a new instance of RelaxControlFactory.
+ *
+ * @param codec The LDAP codec
+ */
+ public RelaxControlFactory( LdapApiService codec )
+ {
+ super( codec, RelaxControl.OID );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public RelaxControl newControl()
+ {
+ return new RelaxControlImpl();
+ }
+}