directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1401815 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/ apacheds/trunk/core-integ/src/test/java/org/...
Date Wed, 24 Oct 2012 18:33:22 GMT
Author: elecharny
Date: Wed Oct 24 18:33:21 2012
New Revision: 1401815

URL: http://svn.apache.org/viewvc?rev=1401815&view=rev
Log:
Moved the PasswordUtil class into shared

Added:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/EncryptionMethod.java
      - copied, changed from r1401246, directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/PasswordUtil.java
      - copied, changed from r1401246, directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java
Removed:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java
Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/PasswordHashingInterceptorTest.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/apacheds/trunk/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyIT.java?rev=1401815&r1=1401814&r2=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyIT.java
Wed Oct 24 18:33:21 2012
@@ -42,7 +42,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.InterceptorEnum;
 import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
-import org.apache.directory.server.core.api.authn.PasswordUtil;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -71,6 +70,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.Response;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.password.PasswordUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/PasswordHashingInterceptorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/PasswordHashingInterceptorTest.java?rev=1401815&r1=1401814&r2=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/PasswordHashingInterceptorTest.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/PasswordHashingInterceptorTest.java
Wed Oct 24 18:33:21 2012
@@ -29,7 +29,6 @@ import java.util.Arrays;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
 import org.apache.directory.server.core.annotations.CreateDS;
-import org.apache.directory.server.core.api.authn.PasswordUtil;
 import org.apache.directory.server.core.hash.Md5PasswordHashingInterceptor;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
@@ -44,6 +43,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.password.PasswordUtil;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.junit.After;
 import org.junit.AfterClass;

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java?rev=1401815&r1=1401814&r2=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
(original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
Wed Oct 24 18:33:21 2012
@@ -34,7 +34,6 @@ import java.util.Date;
 
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InterceptorEnum;
-import org.apache.directory.server.core.api.authn.PasswordUtil;
 import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyException;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -46,6 +45,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.password.PasswordUtil;
 import org.apache.directory.shared.util.DateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1401815&r1=1401814&r2=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Wed Oct 24 18:33:21 2012
@@ -40,6 +40,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -48,7 +49,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InterceptorEnum;
 import org.apache.directory.server.core.api.LdapPrincipal;
-import org.apache.directory.server.core.api.authn.PasswordUtil;
 import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyException;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
@@ -93,6 +93,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.password.PasswordUtil;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.util.DateUtils;
 import org.apache.directory.shared.util.StringConstants;
@@ -533,7 +534,7 @@ public class AuthenticationInterceptor e
                 }
                 else
                 {
-                    PasswordUtil.purgeFailureTimes( policyConfig, pwdFailTimeAt );
+                    purgeFailureTimes( policyConfig, pwdFailTimeAt );
                 }
 
                 String failureTime = DateUtils.getGeneralizedTime();
@@ -1624,4 +1625,38 @@ public class AuthenticationInterceptor e
     {
         this.pwdPolicyContainer = pwdPolicyContainer;
     }
+
+
+    /**
+     * purges failure timestamps which are older than the configured interval
+     * (section 7.6 in the draft)
+     */
+    private void purgeFailureTimes( PasswordPolicyConfiguration config, Attribute pwdFailTimeAt
)
+    {
+        long interval = config.getPwdFailureCountInterval();
+
+        if ( interval == 0 )
+        {
+            return;
+        }
+
+        interval *= 1000;
+
+        long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
+
+        Iterator<Value<?>> itr = pwdFailTimeAt.iterator();
+        
+        while ( itr.hasNext() )
+        {
+            Value<?> value = itr.next();
+            String failureTime = value.getString();
+            long time = DateUtils.getDate( failureTime ).getTime();
+            time += interval;
+
+            if ( currentTime >= time )
+            {
+                itr.remove();
+            }
+        }
+    }
 }

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=1401815&r1=1401814&r2=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
(original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
Wed Oct 24 18:33:21 2012
@@ -30,7 +30,6 @@ import javax.naming.Context;
 import org.apache.commons.collections.map.LRUMap;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.directory.server.core.api.LdapPrincipal;
-import org.apache.directory.server.core.api.authn.PasswordUtil;
 import org.apache.directory.server.core.api.entry.ClonedServerEntry;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -44,6 +43,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.password.PasswordUtil;
 import org.apache.directory.shared.util.Base64;
 import org.apache.directory.shared.util.StringConstants;
 import org.apache.directory.shared.util.Strings;

Modified: directory/apacheds/trunk/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java?rev=1401815&r1=1401814&r2=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
Wed Oct 24 18:33:21 2012
@@ -23,7 +23,6 @@ package org.apache.directory.server.core
 
 import java.util.List;
 
-import org.apache.directory.server.core.api.authn.PasswordUtil;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -34,6 +33,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.password.PasswordUtil;
 
 
 /**

Copied: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/EncryptionMethod.java
(from r1401246, directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/EncryptionMethod.java?p2=directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/EncryptionMethod.java&p1=directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java&r1=1401246&r2=1401815&rev=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/EncryptionMethod.java
Wed Oct 24 18:33:21 2012
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.directory.server.core.api.authn;
+package org.apache.directory.shared.ldap.model.password;
 
 
 import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;

Copied: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/PasswordUtil.java
(from r1401246, directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/PasswordUtil.java?p2=directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/PasswordUtil.java&p1=directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java&r1=1401246&r2=1401815&rev=1401815&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/password/PasswordUtil.java
Wed Oct 24 18:33:21 2012
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.directory.server.core.api.authn;
+package org.apache.directory.shared.ldap.model.password;
 
 
 import java.io.UnsupportedEncodingException;
@@ -30,7 +30,6 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.Iterator;
 
-import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -511,38 +510,4 @@ public class PasswordUtil
 
         return expired;
     }
-
-
-    /**
-     * purges failure timestamps which are older than the configured interval
-     * (section 7.6 in the draft)
-     */
-    public static void purgeFailureTimes( PasswordPolicyConfiguration config, Attribute pwdFailTimeAt
)
-    {
-        long interval = config.getPwdFailureCountInterval();
-
-        if ( interval == 0 )
-        {
-            return;
-        }
-
-        interval *= 1000;
-
-        long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
-
-        Iterator<Value<?>> itr = pwdFailTimeAt.iterator();
-        
-        while ( itr.hasNext() )
-        {
-            Value<?> value = itr.next();
-            String failureTime = value.getString();
-            long time = DateUtils.getDate( failureTime ).getTime();
-            time += interval;
-
-            if ( currentTime >= time )
-            {
-                itr.remove();
-            }
-        }
-    }
 }



Mime
View raw message