You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/01/29 11:39:58 UTC
svn commit: r1064995 - in /directory:
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/
apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/
apacheds/trunk/core/src/main/java/org/apache/dir...
Author: akarasulu
Date: Sat Jan 29 10:39:57 2011
New Revision: 1064995
URL: http://svn.apache.org/viewvc?rev=1064995&view=rev
Log:
fixing and migrating more controls (replication related)
Added:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyRequest.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyResponse.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequest.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java
- copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponse.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseContainer.java
- copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java
- copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseGrammar.java
- copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseStates.java
- copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseTags.java
- copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTags.java
Removed:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTags.java
Modified:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/PPolicyInit.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreError.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreGraceAuthsRemaining.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreTimeBeforeExpiration.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java Sat Jan 29 10:39:57 2011
@@ -42,9 +42,10 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestControl;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControl;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControlDecoder;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.IPasswordPolicyResponse;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestDecorator;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecorator;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecoder;
import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -52,14 +53,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.model.message.AddRequest;
-import org.apache.directory.shared.ldap.model.message.AddRequestImpl;
import org.apache.directory.shared.ldap.model.message.*;
-import org.apache.directory.shared.ldap.model.message.ModifyRequest;
-import org.apache.directory.shared.ldap.model.message.ModifyRequestImpl;
-import org.apache.directory.shared.ldap.model.message.Response;
-import org.apache.directory.shared.ldap.model.message.ModifyResponse;
-import org.apache.directory.shared.ldap.model.message.Control;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.junit.After;
import org.junit.Before;
@@ -81,9 +75,9 @@ public class PasswordPolicyTest extends
{
private PasswordPolicyConfiguration policyConfig;
- private static final PasswordPolicyRequestControl PP_REQ_CTRL = new PasswordPolicyRequestControl();
+ private static final PasswordPolicyRequestDecorator PP_REQ_CTRL = new PasswordPolicyRequestDecorator();
- private static final PasswordPolicyResponseControlDecoder decoder = new PasswordPolicyResponseControlDecoder();
+ private static final PasswordPolicyResponseDecoder decoder = new PasswordPolicyResponseDecoder();
@Before
@@ -136,7 +130,7 @@ public class PasswordPolicyTest extends
AddResponse addResp = connection.add( addRequest );
assertEquals( ResultCodeEnum.CONSTRAINT_VIOLATION, addResp.getLdapResult().getResultCode() );
- PasswordPolicyResponseControl respCtrl = getPwdRespCtrl( addResp );
+ IPasswordPolicyResponse respCtrl = getPwdRespCtrl( addResp );
assertNotNull( respCtrl );
assertEquals( PASSWORD_TOO_SHORT, respCtrl.getPasswordPolicyError() );
@@ -176,7 +170,7 @@ public class PasswordPolicyTest extends
AddResponse addResp = connection.add( addRequest );
assertEquals( ResultCodeEnum.CONSTRAINT_VIOLATION, addResp.getLdapResult().getResultCode() );
- PasswordPolicyResponseControl respCtrl = getPwdRespCtrl( addResp );
+ IPasswordPolicyResponse respCtrl = getPwdRespCtrl( addResp );
assertNotNull( respCtrl );
assertEquals( INSUFFICIENT_PASSWORD_QUALITY, respCtrl.getPasswordPolicyError() );
@@ -214,7 +208,7 @@ public class PasswordPolicyTest extends
AddResponse addResp = connection.add( addRequest );
assertEquals( ResultCodeEnum.SUCCESS, addResp.getLdapResult().getResultCode() );
- PasswordPolicyResponseControl respCtrl = getPwdRespCtrl( addResp );
+ IPasswordPolicyResponse respCtrl = getPwdRespCtrl( addResp );
assertNull( respCtrl );
ModifyRequest modReq = new ModifyRequestImpl();
@@ -239,7 +233,7 @@ public class PasswordPolicyTest extends
}
- private PasswordPolicyResponseControl getPwdRespCtrl( Response resp ) throws Exception
+ private IPasswordPolicyResponse getPwdRespCtrl( Response resp ) throws Exception
{
Control ctrl = resp.getControls().get( PP_REQ_CTRL.getOid() );
@@ -248,7 +242,7 @@ public class PasswordPolicyTest extends
return null;
}
- PasswordPolicyResponseControl respCtrl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator respCtrl = new PasswordPolicyResponseDecorator();
decoder.decode( ctrl.getValue(), respCtrl );
return respCtrl;
Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Sat Jan 29 10:39:57 2011
@@ -79,10 +79,11 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.controls.ControlEnum;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.codec.controls.ManageDsaITDecorator;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestControl;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControl;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControlContainer;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControlDecoder;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.IPasswordPolicyRequest;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestDecorator;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecorator;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseContainer;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecoder;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.ISyncDoneValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueContainer;
@@ -191,7 +192,7 @@ public abstract class ServerContext impl
ADS_CONTROLS.put( EntryChange.OID, ControlEnum.ENTRY_CHANGE_CONTROL );
ADS_CONTROLS.put( ManageDsaIT.OID, ControlEnum.MANAGE_DSA_IT_CONTROL );
ADS_CONTROLS.put( PagedResults.OID, ControlEnum.PAGED_RESULTS_CONTROL );
- ADS_CONTROLS.put( PasswordPolicyRequestControl.CONTROL_OID, ControlEnum.PASSWORD_POLICY_REQUEST_CONTROL );
+ ADS_CONTROLS.put( IPasswordPolicyRequest.OID, ControlEnum.PASSWORD_POLICY_REQUEST_CONTROL );
ADS_CONTROLS.put( PersistentSearch.OID, ControlEnum.PERSISTENT_SEARCH_CONTROL );
ADS_CONTROLS.put( Subentries.OID, ControlEnum.SUBENTRIES_CONTROL );
ADS_CONTROLS.put( ISyncDoneValue.OID, ControlEnum.SYNC_DONE_VALUE_CONTROL );
@@ -428,19 +429,19 @@ public abstract class ServerContext impl
case PASSWORD_POLICY_REQUEST_CONTROL:
if ( isRequest )
{
- control = new PasswordPolicyRequestControl();
+ control = new PasswordPolicyRequestDecorator();
}
else
{
- control = new PasswordPolicyResponseControl();
- PasswordPolicyResponseControlDecoder passwordPolicyResponseControlDecoder = new PasswordPolicyResponseControlDecoder();
- PasswordPolicyResponseControlContainer passwordPolicyResponseControlContainer = new PasswordPolicyResponseControlContainer();
- passwordPolicyResponseControlContainer
- .setPasswordPolicyResponseControl( ( PasswordPolicyResponseControl ) control );
+ control = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecoder passwordPolicyResponseDecoder = new PasswordPolicyResponseDecoder();
+ PasswordPolicyResponseContainer passwordPolicyResponseContainer = new PasswordPolicyResponseContainer();
+ passwordPolicyResponseContainer
+ .setPasswordPolicyResponseControl( ( PasswordPolicyResponseDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
- passwordPolicyResponseControlDecoder.decode( bb, passwordPolicyResponseControlContainer );
+ passwordPolicyResponseDecoder.decode( bb, passwordPolicyResponseContainer );
}
break;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Sat Jan 29 10:39:57 2011
@@ -83,9 +83,9 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.subtree.SubentryInterceptor;
import org.apache.directory.server.core.trigger.TriggerInterceptor;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.IPasswordPolicyRequest;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyErrorEnum;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestControl;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControl;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecorator;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -348,7 +348,7 @@ public class AuthenticationInterceptor e
PasswordPolicyConfiguration policyConfig = directoryService.getPwdPolicy( entry );
- boolean isPPolicyReqCtrlPresent = addContext.hasRequestControl( PasswordPolicyRequestControl.CONTROL_OID );
+ boolean isPPolicyReqCtrlPresent = addContext.hasRequestControl( IPasswordPolicyRequest.OID );
checkPwdReset( addContext );
@@ -372,7 +372,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( e.getErrorCode() );
addContext.addResponseControl( responseControl );
}
@@ -511,7 +511,7 @@ public class AuthenticationInterceptor e
// handle the case where pwdPolicySubentry AT is about to be deleted in thid modify()
PasswordPolicyConfiguration policyConfig = directoryService.getPwdPolicy( modifyContext.getOriginalEntry() );
- boolean isPPolicyReqCtrlPresent = modifyContext.hasRequestControl( PasswordPolicyRequestControl.CONTROL_OID );
+ boolean isPPolicyReqCtrlPresent = modifyContext.hasRequestControl( IPasswordPolicyRequest.OID );
Dn userDn = modifyContext.getSession().getAuthenticatedPrincipal().getDN();
PwdModDetailsHolder pwdModDetails = null;
@@ -528,7 +528,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
modifyContext.addResponseControl( responseControl );
}
@@ -544,7 +544,7 @@ public class AuthenticationInterceptor e
LOG.debug( "trying to update password attribute without the supplying the old password" );
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.MUST_SUPPLY_OLD_PASSWORD );
modifyContext.addResponseControl( responseControl );
}
@@ -558,7 +558,7 @@ public class AuthenticationInterceptor e
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_MOD_NOT_ALLOWED );
modifyContext.addResponseControl( responseControl );
}
@@ -572,7 +572,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG );
modifyContext.addResponseControl( responseControl );
}
@@ -600,7 +600,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( e.getErrorCode() );
modifyContext.addResponseControl( responseControl );
}
@@ -632,7 +632,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl responseControl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_IN_HISTORY );
modifyContext.addResponseControl( responseControl );
}
@@ -873,8 +873,8 @@ public class AuthenticationInterceptor e
return;
}
- boolean isPPolicyReqCtrlPresent = bindContext.hasRequestControl( PasswordPolicyRequestControl.CONTROL_OID );
- PasswordPolicyResponseControl pwdRespCtrl = new PasswordPolicyResponseControl();
+ boolean isPPolicyReqCtrlPresent = bindContext.hasRequestControl( IPasswordPolicyRequest.OID );
+ PasswordPolicyResponseDecorator pwdRespCtrl = new PasswordPolicyResponseDecorator();
boolean authenticated = false;
PasswordPolicyException ppe = null;
@@ -1429,10 +1429,10 @@ public class AuthenticationInterceptor e
if ( pwdResetSet.contains( userDn ) )
{
boolean isPPolicyReqCtrlPresent = opContext
- .hasRequestControl( PasswordPolicyRequestControl.CONTROL_OID );
+ .hasRequestControl( IPasswordPolicyRequest.OID );
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseControl pwdRespCtrl = new PasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator pwdRespCtrl = new PasswordPolicyResponseDecorator();
pwdRespCtrl.setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
opContext.addResponseControl( pwdRespCtrl );
}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyRequest.java?rev=1064995&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyRequest.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyRequest.java Sat Jan 29 10:39:57 2011
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
+ * http://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.shared.ldap.codec.controls.ppolicy;
+
+
+import org.apache.directory.shared.ldap.model.message.Control;
+
+
+/**
+ * The password policy control.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IPasswordPolicyRequest extends Control
+{
+
+ /** the password policy request control */
+ public static final String OID = "1.3.6.1.4.1.42.2.27.8.5.1";
+
+ /** an instance that can be repeatedly reused */
+ public static final IPasswordPolicyRequest INSTANCE = new PasswordPolicyRequest();
+}
\ No newline at end of file
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyResponse.java?rev=1064995&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyResponse.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/IPasswordPolicyResponse.java Sat Jan 29 10:39:57 2011
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ * http://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.shared.ldap.codec.controls.ppolicy;
+
+
+import org.apache.directory.shared.ldap.model.message.Control;
+
+
+/**
+ * PasswordPolicyResponseControl.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface IPasswordPolicyResponse extends Control
+{
+
+ int getTimeBeforeExpiration();
+
+
+ void setTimeBeforeExpiration( int timeBeforeExpiration );
+
+
+ int getGraceAuthNsRemaining();
+
+
+ void setGraceAuthNsRemaining( int graceAuthNsRemaining );
+
+
+ PasswordPolicyErrorEnum getPasswordPolicyError();
+
+
+ void setPasswordPolicyError( PasswordPolicyErrorEnum ppolicyError );
+
+}
\ No newline at end of file
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequest.java?rev=1064995&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequest.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequest.java Sat Jan 29 10:39:57 2011
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
+ * http://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.shared.ldap.codec.controls.ppolicy;
+
+
+/**
+ * A simple {@link IPasswordPolicyRequest} implementation to hold properties.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PasswordPolicyRequest implements IPasswordPolicyRequest
+{
+ private boolean critical;
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getOid()
+ {
+ return OID;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isCritical()
+ {
+ return critical;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setCritical( boolean critical )
+ {
+ this.critical = critical;
+ }
+}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java&r1=1064846&r2=1064995&rev=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestDecorator.java Sat Jan 29 10:39:57 2011
@@ -20,7 +20,9 @@
package org.apache.directory.shared.ldap.codec.controls.ppolicy;
-import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
/**
@@ -28,15 +30,12 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PasswordPolicyRequestControl extends ControlImpl
+public class PasswordPolicyRequestDecorator extends ControlDecorator<IPasswordPolicyRequest>
+ implements IPasswordPolicyRequest
{
- /** the password policy request control */
- public static final String CONTROL_OID = "1.3.6.1.4.1.42.2.27.8.5.1";
-
-
- public PasswordPolicyRequestControl()
+ public PasswordPolicyRequestDecorator()
{
- super( CONTROL_OID );
+ super( IPasswordPolicyRequest.INSTANCE );
}
@@ -44,4 +43,11 @@ public class PasswordPolicyRequestContro
{
return 0;
}
+
+
+ @Override
+ public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+ {
+ return this;
+ }
}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponse.java?rev=1064995&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponse.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponse.java Sat Jan 29 10:39:57 2011
@@ -0,0 +1,113 @@
+/*
+ * 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
+ *
+ * http://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.shared.ldap.codec.controls.ppolicy;
+
+
+/**
+ * A PasswordPolicyResponse.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PasswordPolicyResponse implements IPasswordPolicyResponse
+{
+ /** time before expiration of the password */
+ private int timeBeforeExpiration = -1;
+
+ /** number of remaining grace authentications */
+ private int graceAuthNsRemaining = -1;
+
+ /** number representing the password policy error */
+ private PasswordPolicyErrorEnum ppolicyError;
+
+ private boolean critical;
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getTimeBeforeExpiration()
+ {
+ return timeBeforeExpiration;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setTimeBeforeExpiration( int timeBeforeExpiration )
+ {
+ this.timeBeforeExpiration = timeBeforeExpiration;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getGraceAuthNsRemaining()
+ {
+ return graceAuthNsRemaining;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setGraceAuthNsRemaining( int graceAuthNsRemaining )
+ {
+ this.graceAuthNsRemaining = graceAuthNsRemaining;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public PasswordPolicyErrorEnum getPasswordPolicyError()
+ {
+ return ppolicyError;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setPasswordPolicyError( PasswordPolicyErrorEnum ppolicyError )
+ {
+ this.ppolicyError = ppolicyError;
+ }
+
+
+ public String getOid()
+ {
+ return PasswordPolicyRequest.OID;
+ }
+
+
+ public boolean isCritical()
+ {
+ return critical;
+ }
+
+
+ public void setCritical( boolean critical )
+ {
+ this.critical = critical;
+ }
+}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseContainer.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseContainer.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseContainer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java&r1=1064846&r2=1064995&rev=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseContainer.java Sat Jan 29 10:39:57 2011
@@ -29,27 +29,38 @@ import org.apache.directory.shared.asn1.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PasswordPolicyResponseControlContainer extends AbstractContainer
+public class PasswordPolicyResponseContainer extends AbstractContainer
{
- private PasswordPolicyResponseControl control;
+ private PasswordPolicyResponseDecorator control;
- public PasswordPolicyResponseControlContainer()
+ public PasswordPolicyResponseContainer()
{
super();
+ control = new PasswordPolicyResponseDecorator( new PasswordPolicyResponseDecorator() );
stateStack = new int[1];
- grammar = PasswordPolicyResponseControlGrammar.getInstance();
- setTransition( PasswordPolicyResponseControlStates.START_STATE );
+ grammar = PasswordPolicyResponseGrammar.getInstance();
+ setTransition( PasswordPolicyResponseStates.START_STATE );
}
- public PasswordPolicyResponseControl getPasswordPolicyResponseControl()
+ public PasswordPolicyResponseContainer( IPasswordPolicyResponse ppolicyResponse )
+ {
+ super();
+ control = new PasswordPolicyResponseDecorator( ppolicyResponse );
+ stateStack = new int[1];
+ grammar = PasswordPolicyResponseGrammar.getInstance();
+ setTransition( PasswordPolicyResponseStates.START_STATE );
+ }
+
+
+ public PasswordPolicyResponseDecorator getPasswordPolicyResponseControl()
{
return control;
}
- public void setPasswordPolicyResponseControl( PasswordPolicyResponseControl control )
+ public void setPasswordPolicyResponseControl( PasswordPolicyResponseDecorator control )
{
this.control = control;
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java&r1=1064846&r2=1064995&rev=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseDecorator.java Sat Jan 29 10:39:57 2011
@@ -17,18 +17,20 @@
* under the License.
*
*/
-
package org.apache.directory.shared.ldap.codec.controls.ppolicy;
import java.nio.ByteBuffer;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
/**
@@ -36,17 +38,10 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PasswordPolicyResponseControl extends AbstractControl
+public class PasswordPolicyResponseDecorator extends ControlDecorator<IPasswordPolicyResponse> implements IPasswordPolicyResponse
{
-
- /** time before expiration of the password */
- private int timeBeforeExpiration = -1;
-
- /** number of remaining grace authentications */
- private int graceAuthNsRemaining = -1;
-
- /** number representing the password policy error */
- private PasswordPolicyErrorEnum ppolicyError;
+ /** An instance of this decoder */
+ private static final Asn1Decoder decoder = new Asn1Decoder();
// Storage for computed lengths
private transient int valueLength = 0;
@@ -55,23 +50,30 @@ public class PasswordPolicyResponseContr
private transient int timeBeforeExpirationTagLength;
private transient int graceAuthNsRemainingTagLength;
- public PasswordPolicyResponseControl()
+
+ public PasswordPolicyResponseDecorator()
{
- super( PasswordPolicyRequestControl.CONTROL_OID );
+ super( new PasswordPolicyResponse() );
+ }
+
+
+ public PasswordPolicyResponseDecorator( IPasswordPolicyResponse response )
+ {
+ super( response );
}
@Override
public int computeLength()
{
- if ( timeBeforeExpiration >= 0 )
+ if ( getTimeBeforeExpiration() >= 0 )
{
- timeBeforeExpirationTagLength = TLV.getNbBytes( timeBeforeExpiration );
+ timeBeforeExpirationTagLength = TLV.getNbBytes( getTimeBeforeExpiration() );
warningLength = 1 + TLV.getNbBytes( timeBeforeExpirationTagLength ) + timeBeforeExpirationTagLength;
}
- else if ( graceAuthNsRemaining >= 0 )
+ else if ( getGraceAuthNsRemaining() >= 0 )
{
- graceAuthNsRemainingTagLength = TLV.getNbBytes( graceAuthNsRemaining );
+ graceAuthNsRemainingTagLength = TLV.getNbBytes( getGraceAuthNsRemaining() );
warningLength = 1 + TLV.getNbBytes( graceAuthNsRemainingTagLength ) + graceAuthNsRemainingTagLength;
}
@@ -80,7 +82,7 @@ public class PasswordPolicyResponseContr
ppolicySeqLength = 1 + TLV.getNbBytes( warningLength ) + warningLength;
}
- if ( ppolicyError != null )
+ if ( getPasswordPolicyError() != null )
{
ppolicySeqLength += 1 + 1 + 1;
}
@@ -112,7 +114,7 @@ public class PasswordPolicyResponseContr
buffer.put( TLV.getBytes( valueLength ) );
}
- if ( ( timeBeforeExpiration < 0 ) && ( graceAuthNsRemaining < 0 ) && ( ppolicyError == null ) )
+ if ( ( getTimeBeforeExpiration() < 0 ) && ( getGraceAuthNsRemaining() < 0 ) && ( getPasswordPolicyError() == null ) )
{
return buffer;
}
@@ -125,28 +127,28 @@ public class PasswordPolicyResponseContr
if ( warningLength > 0 )
{
// Encode the Warning tag
- buffer.put( (byte)PasswordPolicyResponseControlTags.PPOLICY_WARNING_TAG.getValue() );
+ buffer.put( ( byte )PasswordPolicyResponseTags.PPOLICY_WARNING_TAG.getValue() );
buffer.put( TLV.getBytes( warningLength ) );
- if ( timeBeforeExpiration >= 0 )
+ if ( getTimeBeforeExpiration() >= 0 )
{
- buffer.put( ( byte ) PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG.getValue() );
+ buffer.put( ( byte ) PasswordPolicyResponseTags.TIME_BEFORE_EXPIRATION_TAG.getValue() );
buffer.put( TLV.getBytes( timeBeforeExpirationTagLength ) );
- buffer.put( Value.getBytes( timeBeforeExpiration ) );
+ buffer.put( Value.getBytes( getTimeBeforeExpiration() ) );
}
- else if ( graceAuthNsRemaining >= 0 )
+ else if ( getGraceAuthNsRemaining() >= 0 )
{
- buffer.put( ( byte ) PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG.getValue() );
+ buffer.put( ( byte ) PasswordPolicyResponseTags.GRACE_AUTHNS_REMAINING_TAG.getValue() );
buffer.put( TLV.getBytes( graceAuthNsRemainingTagLength ) );
- buffer.put( Value.getBytes( graceAuthNsRemaining ) );
+ buffer.put( Value.getBytes( getGraceAuthNsRemaining() ) );
}
}
- if ( ppolicyError != null )
+ if ( getPasswordPolicyError() != null )
{
- buffer.put( (byte)PasswordPolicyResponseControlTags.PPOLICY_ERROR_TAG.getValue() );
+ buffer.put( (byte)PasswordPolicyResponseTags.PPOLICY_ERROR_TAG.getValue() );
buffer.put( ( byte ) 0x01 );
- buffer.put( Value.getBytes( ppolicyError.getValue() ) );
+ buffer.put( Value.getBytes( getPasswordPolicyError().getValue() ) );
}
}
@@ -154,39 +156,57 @@ public class PasswordPolicyResponseContr
}
+ /**
+ * {@inheritDoc}
+ */
public int getTimeBeforeExpiration()
{
- return timeBeforeExpiration;
+ return getDecorated().getTimeBeforeExpiration();
}
+ /**
+ * {@inheritDoc}
+ */
public void setTimeBeforeExpiration( int timeBeforeExpiration )
{
- this.timeBeforeExpiration = timeBeforeExpiration;
+ getDecorated().setTimeBeforeExpiration( timeBeforeExpiration );
}
+ /**
+ * {@inheritDoc}
+ */
public int getGraceAuthNsRemaining()
{
- return graceAuthNsRemaining;
+ return getDecorated().getGraceAuthNsRemaining();
}
+ /**
+ * {@inheritDoc}
+ */
public void setGraceAuthNsRemaining( int graceAuthNsRemaining )
{
- this.graceAuthNsRemaining = graceAuthNsRemaining;
+ getDecorated().setGraceAuthNsRemaining( graceAuthNsRemaining );
}
+ /**
+ * {@inheritDoc}
+ */
public PasswordPolicyErrorEnum getPasswordPolicyError()
{
- return ppolicyError;
+ return getDecorated().getPasswordPolicyError();
}
+ /**
+ * {@inheritDoc}
+ */
public void setPasswordPolicyError( PasswordPolicyErrorEnum ppolicyError )
{
- this.ppolicyError = ppolicyError;
+ getDecorated().setPasswordPolicyError( ppolicyError );
}
@@ -198,21 +218,30 @@ public class PasswordPolicyResponseContr
sb.append( " PasswordPolicyResponse control :\n" );
sb.append( " oid : '" ).append( getOid() ).append( '\n' );
- if ( timeBeforeExpiration >= 0 )
+ if ( getTimeBeforeExpiration() >= 0 )
{
- sb.append( " timeBeforeExpiration : '" ).append( timeBeforeExpiration ).append( '\n' );
+ sb.append( " timeBeforeExpiration : '" ).append( getTimeBeforeExpiration() ).append( '\n' );
}
- else if ( graceAuthNsRemaining >= 0 )
+ else if ( getGraceAuthNsRemaining() >= 0 )
{
- sb.append( " graceAuthNsRemaining : '" ).append( graceAuthNsRemaining ).append( '\n' );
+ sb.append( " graceAuthNsRemaining : '" ).append( getGraceAuthNsRemaining() ).append( '\n' );
}
- if ( ppolicyError != null )
+ if ( getPasswordPolicyError() != null )
{
- sb.append( " ppolicyError : '" ).append( ppolicyError.toString() ).append( '\n' );
+ sb.append( " ppolicyError : '" ).append( getPasswordPolicyError().toString() ).append( '\n' );
}
return sb.toString();
}
+
+ @Override
+ public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+ {
+ ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer( this );
+ decoder.decode( bb, container );
+ return this;
+ }
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseGrammar.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseGrammar.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseGrammar.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java&r1=1064846&r2=1064995&rev=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseGrammar.java Sat Jan 29 10:39:57 2011
@@ -53,65 +53,65 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PasswordPolicyResponseControlGrammar extends AbstractGrammar
+public class PasswordPolicyResponseGrammar extends AbstractGrammar
{
/** PasswordPolicyResponseControlGrammar singleton instance */
- private static final PasswordPolicyResponseControlGrammar INSTANCE = new PasswordPolicyResponseControlGrammar();
+ private static final PasswordPolicyResponseGrammar INSTANCE = new PasswordPolicyResponseGrammar();
- private PasswordPolicyResponseControlGrammar()
+ private PasswordPolicyResponseGrammar()
{
- setName( PasswordPolicyResponseControlGrammar.class.getName() );
+ setName( PasswordPolicyResponseGrammar.class.getName() );
- super.transitions = new GrammarTransition[PasswordPolicyResponseControlStates.END_STATE.ordinal()][256];
+ super.transitions = new GrammarTransition[PasswordPolicyResponseStates.END_STATE.ordinal()][256];
// PasswordPolicyResponseValue ::= SEQUENCE {
// ...
- super.transitions[PasswordPolicyResponseControlStates.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.START_STATE, PasswordPolicyResponseControlStates.PPOLICY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
+ super.transitions[PasswordPolicyResponseStates.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.START_STATE, PasswordPolicyResponseStates.PPOLICY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
new PPolicyInit());
// PasswordPolicyResponseValue ::= SEQUENCE {
// warning [0] CHOICE {
- super.transitions[PasswordPolicyResponseControlStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyResponseControlTags.PPOLICY_WARNING_TAG.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.PPOLICY_SEQ_STATE, PasswordPolicyResponseControlStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyResponseControlTags.PPOLICY_WARNING_TAG.getValue(),
+ super.transitions[PasswordPolicyResponseStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyResponseTags.PPOLICY_WARNING_TAG.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.PPOLICY_SEQ_STATE, PasswordPolicyResponseStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyResponseTags.PPOLICY_WARNING_TAG.getValue(),
new CheckNotNullLength());
// PasswordPolicyResponseValue ::= SEQUENCE {
// ...
// error [1] ENUMERATED {
- super.transitions[PasswordPolicyResponseControlStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyResponseControlTags.PPOLICY_ERROR_TAG.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.PPOLICY_SEQ_STATE, PasswordPolicyResponseControlStates.PPOLICY_ERROR_TAG_STATE, PasswordPolicyResponseControlTags.PPOLICY_ERROR_TAG.getValue(),
+ super.transitions[PasswordPolicyResponseStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyResponseTags.PPOLICY_ERROR_TAG.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.PPOLICY_SEQ_STATE, PasswordPolicyResponseStates.PPOLICY_ERROR_TAG_STATE, PasswordPolicyResponseTags.PPOLICY_ERROR_TAG.getValue(),
new StoreError());
// PasswordPolicyResponseValue ::= SEQUENCE {
// warning [0] CHOICE {
// timeBeforeExpiration [0] INTEGER (0 .. maxInt),
- super.transitions[PasswordPolicyResponseControlStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyResponseControlStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE, PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG.getValue(),
+ super.transitions[PasswordPolicyResponseStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyResponseTags.TIME_BEFORE_EXPIRATION_TAG.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyResponseStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE, PasswordPolicyResponseTags.TIME_BEFORE_EXPIRATION_TAG.getValue(),
new StoreTimeBeforeExpiration());
// PasswordPolicyResponseValue ::= SEQUENCE {
// warning [0] CHOICE {
// ...
// graceAuthNsRemaining [1] INTEGER (0 .. maxInt) } OPTIONAL,
- super.transitions[PasswordPolicyResponseControlStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyResponseControlStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE, PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
+ super.transitions[PasswordPolicyResponseStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyResponseTags.GRACE_AUTHNS_REMAINING_TAG.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyResponseStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE, PasswordPolicyResponseTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
new StoreGraceAuthsRemaining());
// PasswordPolicyResponseValue ::= SEQUENCE {
// ...
// error [1] ENUMERATED {
- super.transitions[PasswordPolicyResponseControlStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE.ordinal()][PasswordPolicyResponseControlTags.PPOLICY_ERROR_TAG.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE, PasswordPolicyResponseControlStates.PPOLICY_ERROR_TAG_STATE, PasswordPolicyResponseControlTags.PPOLICY_ERROR_TAG.getValue(),
+ super.transitions[PasswordPolicyResponseStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE.ordinal()][PasswordPolicyResponseTags.PPOLICY_ERROR_TAG.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE, PasswordPolicyResponseStates.PPOLICY_ERROR_TAG_STATE, PasswordPolicyResponseTags.PPOLICY_ERROR_TAG.getValue(),
new StoreError());
// PasswordPolicyResponseValue ::= SEQUENCE {
// ...
// error [1] ENUMERATED {
- super.transitions[PasswordPolicyResponseControlStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE.ordinal()][PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG.getValue()] = new GrammarTransition(
- PasswordPolicyResponseControlStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE, PasswordPolicyResponseControlStates.PPOLICY_ERROR_TAG_STATE, PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
+ super.transitions[PasswordPolicyResponseStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE.ordinal()][PasswordPolicyResponseTags.GRACE_AUTHNS_REMAINING_TAG.getValue()] = new GrammarTransition(
+ PasswordPolicyResponseStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE, PasswordPolicyResponseStates.PPOLICY_ERROR_TAG_STATE, PasswordPolicyResponseTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
new StoreError());
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseStates.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseStates.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseStates.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java&r1=1064846&r2=1064995&rev=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseStates.java Sat Jan 29 10:39:57 2011
@@ -26,11 +26,11 @@ import org.apache.directory.shared.asn1.
/**
- * various states used in {@link PasswordPolicyResponseControlGrammar}.
+ * various states used in {@link PasswordPolicyResponseGrammar}.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public enum PasswordPolicyResponseControlStates implements States
+public enum PasswordPolicyResponseStates implements States
{
START_STATE, // 0
@@ -52,7 +52,7 @@ public enum PasswordPolicyResponseContro
*/
public String getGrammarName( Grammar grammar )
{
- if( grammar instanceof PasswordPolicyResponseControlGrammar )
+ if( grammar instanceof PasswordPolicyResponseGrammar )
{
return "PASSWORD_POLICY_RESPONSE_CONTROL_GRAMMAR";
}
@@ -90,7 +90,7 @@ public enum PasswordPolicyResponseContro
/**
* {@inheritDoc}
*/
- public PasswordPolicyResponseControlStates getStartState()
+ public PasswordPolicyResponseStates getStartState()
{
return START_STATE;
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseTags.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTags.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseTags.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseTags.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTags.java&r1=1064846&r2=1064995&rev=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTags.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseTags.java Sat Jan 29 10:39:57 2011
@@ -25,7 +25,7 @@ package org.apache.directory.shared.ldap
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public enum PasswordPolicyResponseControlTags
+public enum PasswordPolicyResponseTags
{
PPOLICY_WARNING_TAG(0xA0), // warning [0]
PPOLICY_ERROR_TAG(0x81), // error [1]
@@ -36,7 +36,7 @@ public enum PasswordPolicyResponseContro
private int value;
- private PasswordPolicyResponseControlTags( int value )
+ private PasswordPolicyResponseTags( int value )
{
this.value = value;
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/PPolicyInit.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/PPolicyInit.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/PPolicyInit.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/PPolicyInit.java Sat Jan 29 10:39:57 2011
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PPolicyInit extends GrammarAction
+public class PPolicyInit extends GrammarAction<Asn1Container>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( PPolicyInit.class );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreError.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreError.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreError.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreError.java Sat Jan 29 10:39:57 2011
@@ -23,7 +23,7 @@ package org.apache.directory.shared.ldap
import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyErrorEnum;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControlContainer;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseContainer;
/**
@@ -49,7 +49,7 @@ public class StoreError extends Abstract
@Override
protected void setIntegerValue( int value, Asn1Container container )
{
- PasswordPolicyResponseControlContainer ppolicyContainer = ( PasswordPolicyResponseControlContainer ) container;
+ PasswordPolicyResponseContainer ppolicyContainer = ( PasswordPolicyResponseContainer ) container;
PasswordPolicyErrorEnum error = PasswordPolicyErrorEnum.get( value );
ppolicyContainer.getPasswordPolicyResponseControl().setPasswordPolicyError( error );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreGraceAuthsRemaining.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreGraceAuthsRemaining.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreGraceAuthsRemaining.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreGraceAuthsRemaining.java Sat Jan 29 10:39:57 2011
@@ -22,7 +22,7 @@ package org.apache.directory.shared.ldap
import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControlContainer;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseContainer;
/**
@@ -48,7 +48,7 @@ public class StoreGraceAuthsRemaining ex
@Override
protected void setIntegerValue( int value, Asn1Container container )
{
- PasswordPolicyResponseControlContainer ppolicyContainer = ( PasswordPolicyResponseControlContainer ) container;
+ PasswordPolicyResponseContainer ppolicyContainer = ( PasswordPolicyResponseContainer ) container;
ppolicyContainer.getPasswordPolicyResponseControl().setGraceAuthNsRemaining( value );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreTimeBeforeExpiration.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreTimeBeforeExpiration.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreTimeBeforeExpiration.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/actions/StoreTimeBeforeExpiration.java Sat Jan 29 10:39:57 2011
@@ -22,7 +22,7 @@ package org.apache.directory.shared.ldap
import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseControlContainer;
+import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseContainer;
/**
@@ -48,7 +48,7 @@ public class StoreTimeBeforeExpiration e
@Override
protected void setIntegerValue( int value, Asn1Container container )
{
- PasswordPolicyResponseControlContainer ppolicyContainer = ( PasswordPolicyResponseControlContainer ) container;
+ PasswordPolicyResponseContainer ppolicyContainer = ( PasswordPolicyResponseContainer ) container;
ppolicyContainer.getPasswordPolicyResponseControl().setTimeBeforeExpiration( value );
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java?rev=1064995&r1=1064994&r2=1064995&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java Sat Jan 29 10:39:57 2011
@@ -42,7 +42,7 @@ public class PasswordPolicyResponseContr
@Test
public void testDecodeRespWithExpiryWarningAndError() throws Exception
{
- Asn1Decoder decoder = new PasswordPolicyResponseControlDecoder();
+ Asn1Decoder decoder = new PasswordPolicyResponseDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0xA );
@@ -56,12 +56,12 @@ public class PasswordPolicyResponseContr
bb.flip();
- PasswordPolicyResponseControlContainer container = new PasswordPolicyResponseControlContainer();
- container.setPasswordPolicyResponseControl( new PasswordPolicyResponseControl() );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer();
+ container.setPasswordPolicyResponseControl( new PasswordPolicyResponseDecorator() );
decoder.decode( bb, container );
- PasswordPolicyResponseControl control = container.getPasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator control = container.getPasswordPolicyResponseControl();
assertEquals( 1, control.getTimeBeforeExpiration() );
assertEquals( 1, control.getPasswordPolicyError().getValue() );
@@ -89,7 +89,7 @@ public class PasswordPolicyResponseContr
@Test
public void testDecodeRespWithGraceAuthWarningAndError() throws Exception
{
- Asn1Decoder decoder = new PasswordPolicyResponseControlDecoder();
+ Asn1Decoder decoder = new PasswordPolicyResponseDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0xA );
bb.put( new byte[]
@@ -102,12 +102,12 @@ public class PasswordPolicyResponseContr
bb.flip();
- PasswordPolicyResponseControlContainer container = new PasswordPolicyResponseControlContainer();
- container.setPasswordPolicyResponseControl( new PasswordPolicyResponseControl() );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer();
+ container.setPasswordPolicyResponseControl( new PasswordPolicyResponseDecorator() );
decoder.decode( bb, container );
- PasswordPolicyResponseControl control = container.getPasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator control = container.getPasswordPolicyResponseControl();
assertEquals( 1, control.getGraceAuthNsRemaining() );
assertEquals( 1, control.getPasswordPolicyError().getValue() );
@@ -135,7 +135,7 @@ public class PasswordPolicyResponseContr
@Test
public void testDecodeRespWithTimeBeforeExpiryWarningOnly() throws Exception
{
- Asn1Decoder decoder = new PasswordPolicyResponseControlDecoder();
+ Asn1Decoder decoder = new PasswordPolicyResponseDecoder();
ByteBuffer bb = ByteBuffer.allocate( 7 );
bb.put( new byte[]
@@ -147,12 +147,12 @@ public class PasswordPolicyResponseContr
bb.flip();
- PasswordPolicyResponseControlContainer container = new PasswordPolicyResponseControlContainer();
- container.setPasswordPolicyResponseControl( new PasswordPolicyResponseControl() );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer();
+ container.setPasswordPolicyResponseControl( new PasswordPolicyResponseDecorator() );
decoder.decode( bb, container );
- PasswordPolicyResponseControl control = container.getPasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator control = container.getPasswordPolicyResponseControl();
assertEquals( 1, control.getTimeBeforeExpiration() );
ByteBuffer buffer = ByteBuffer.allocate( 0x26 );
@@ -178,7 +178,7 @@ public class PasswordPolicyResponseContr
@Test
public void testDecodeRespWithGraceAuthWarningOnly() throws Exception
{
- Asn1Decoder decoder = new PasswordPolicyResponseControlDecoder();
+ Asn1Decoder decoder = new PasswordPolicyResponseDecoder();
ByteBuffer bb = ByteBuffer.allocate( 7 );
bb.put( new byte[]
@@ -190,12 +190,12 @@ public class PasswordPolicyResponseContr
bb.flip();
- PasswordPolicyResponseControlContainer container = new PasswordPolicyResponseControlContainer();
- container.setPasswordPolicyResponseControl( new PasswordPolicyResponseControl() );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer();
+ container.setPasswordPolicyResponseControl( new PasswordPolicyResponseDecorator() );
decoder.decode( bb, container );
- PasswordPolicyResponseControl control = container.getPasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator control = container.getPasswordPolicyResponseControl();
assertEquals( 1, control.getGraceAuthNsRemaining() );
ByteBuffer buffer = ByteBuffer.allocate( 0x26 );
@@ -221,7 +221,7 @@ public class PasswordPolicyResponseContr
@Test
public void testDecodeRespWithErrorOnly() throws Exception
{
- Asn1Decoder decoder = new PasswordPolicyResponseControlDecoder();
+ Asn1Decoder decoder = new PasswordPolicyResponseDecoder();
ByteBuffer bb = ByteBuffer.allocate( 5 );
bb.put( new byte[]
@@ -232,12 +232,12 @@ public class PasswordPolicyResponseContr
bb.flip();
- PasswordPolicyResponseControlContainer container = new PasswordPolicyResponseControlContainer();
- container.setPasswordPolicyResponseControl( new PasswordPolicyResponseControl() );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer();
+ container.setPasswordPolicyResponseControl( new PasswordPolicyResponseDecorator() );
decoder.decode( bb, container );
- PasswordPolicyResponseControl control = container.getPasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator control = container.getPasswordPolicyResponseControl();
assertEquals( 1, control.getPasswordPolicyError().getValue() );
ByteBuffer buffer = ByteBuffer.allocate( 0x24 );
@@ -262,7 +262,7 @@ public class PasswordPolicyResponseContr
@Test
public void testDecodeRespWithoutWarningAndError() throws Exception
{
- Asn1Decoder decoder = new PasswordPolicyResponseControlDecoder();
+ Asn1Decoder decoder = new PasswordPolicyResponseDecoder();
ByteBuffer bb = ByteBuffer.allocate( 2 );
bb.put( new byte[]
@@ -272,12 +272,12 @@ public class PasswordPolicyResponseContr
bb.flip();
- PasswordPolicyResponseControlContainer container = new PasswordPolicyResponseControlContainer();
- container.setPasswordPolicyResponseControl( new PasswordPolicyResponseControl() );
+ PasswordPolicyResponseContainer container = new PasswordPolicyResponseContainer();
+ container.setPasswordPolicyResponseControl( new PasswordPolicyResponseDecorator() );
decoder.decode( bb, container );
- PasswordPolicyResponseControl control = container.getPasswordPolicyResponseControl();
+ PasswordPolicyResponseDecorator control = container.getPasswordPolicyResponseControl();
assertNotNull( control );
ByteBuffer buffer = ByteBuffer.allocate( 0x1D );