directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1696333 - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/operations/add/ server-config/src/main/java/org/apache/directory/server/config/beans/ server-config/src/main/resources/ service-builder/src/t...
Date Mon, 17 Aug 2015 20:04:21 GMT
Author: lucastheisen
Date: Mon Aug 17 20:04:20 2015
New Revision: 1696333

URL: http://svn.apache.org/r1696333
Log:
Fixed incorrectly named hashAttribute setter method HashInterceptorBean


Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/PasswordHashingInterceptorTest.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HashInterceptorBean.java
    directory/apacheds/trunk/server-config/src/main/resources/config.ldif
    directory/apacheds/trunk/service-builder/src/test/java/org/apache/directory/server/config/builder/ServiceBuilderTest.java

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=1696333&r1=1696332&r2=1696333&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
Mon Aug 17 20:04:20 2015
@@ -113,9 +113,7 @@ public class PasswordHashingInterceptorT
             { 
                 HashInterceptorBean config = new HashInterceptorBean();
                 config.setHashAlgorithm( "SSHA-256" );
-                List<String> hashAttributes = new ArrayList<>();
-                hashAttributes.add( "userPassword" );
-                config.setHashAttributes( hashAttributes );
+                config.addHashAttributes( new String[] { "2.5.4.35" } );
                 hashMech = new ConfigurableHashingInterceptor( config );
             }
             else 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HashInterceptorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HashInterceptorBean.java?rev=1696333&r1=1696332&r2=1696333&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HashInterceptorBean.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HashInterceptorBean.java
Mon Aug 17 20:04:20 2015
@@ -20,8 +20,10 @@
 package org.apache.directory.server.config.beans;
 
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
 
 import org.apache.directory.server.config.ConfigurationElement;
 
@@ -38,8 +40,8 @@ public class HashInterceptorBean extends
     private String hashAlgorithm;
 
     /** The reference to the Password Policy component */
-    @ConfigurationElement(attributeType = "ads-hashAttribute", isOptional = true, defaultValues
= {"userPassword"} )
-    private List<String> hashAttributes = new ArrayList<String>();
+    @ConfigurationElement(attributeType = "ads-hashAttribute", isOptional = true, defaultValues
= {"2.5.4.35"} )
+    private Set<String> hashAttributes = new HashSet<String>();
 
 
     /**
@@ -52,6 +54,22 @@ public class HashInterceptorBean extends
 
 
     /**
+     * @param hashAttributes The attributes that need to be hashed
+     */
+    public void addHashAttributes( String[] hashAttributes )
+    {
+        if ( hashAttributes != null && hashAttributes.length > 0 ) 
+        {
+            if ( this.hashAttributes == null ) 
+            {
+                this.hashAttributes = new HashSet<String>();
+            }
+            this.hashAttributes.addAll( Arrays.asList( hashAttributes ) );
+        }
+    }
+
+
+    /**
      * @return the hash algorithm
      */
     public String getHashAlgorithm()
@@ -63,7 +81,7 @@ public class HashInterceptorBean extends
     /**
      * @return the attributes to hash
      */
-    public List<String> getHashAttributes()
+    public Set<String> getHashAttributes()
     {
         return hashAttributes;
     }
@@ -78,15 +96,6 @@ public class HashInterceptorBean extends
     }
 
 
-    /**
-     * @param hashAttributes The attributes that need to be hashed
-     */
-    public void setHashAttributes( List<String> hashAttributes )
-    {
-        this.hashAttributes = hashAttributes;
-    }
-
-
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/trunk/server-config/src/main/resources/config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/resources/config.ldif?rev=1696333&r1=1696332&r2=1696333&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/resources/config.ldif (original)
+++ directory/apacheds/trunk/server-config/src/main/resources/config.ldif Mon Aug 17 20:04:20
2015
@@ -198,8 +198,10 @@ objectclass: ads-interceptor
 objectclass: ads-hashInterceptor
 ads-enabled: TRUE
 ads-interceptororder: 9
-ads-interceptorclassname: org.apache.directory.server.core.hash.SshaPasswordHashingInterceptor
+ads-interceptorclassname: org.apache.directory.server.core.hash.ConfigurableHashingInterceptor
 ads-interceptorid: passwordHashingInterceptor
+ads-hashAlgorithm: SSHA
+ads-hashAttribute: 2.5.4.35
 
 dn: ads-interceptorId=schemaInterceptor,ou=interceptors,ads-directoryServiceId=default,ou=config
 objectclass: top

Modified: directory/apacheds/trunk/service-builder/src/test/java/org/apache/directory/server/config/builder/ServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/test/java/org/apache/directory/server/config/builder/ServiceBuilderTest.java?rev=1696333&r1=1696332&r2=1696333&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/test/java/org/apache/directory/server/config/builder/ServiceBuilderTest.java
(original)
+++ directory/apacheds/trunk/service-builder/src/test/java/org/apache/directory/server/config/builder/ServiceBuilderTest.java
Mon Aug 17 20:04:20 2015
@@ -89,10 +89,11 @@ public class ServiceBuilderTest
         HashInterceptorBean bean = new HashInterceptorBean();
         bean.setInterceptorClassName( "org.apache.directory.server.core.hash.ConfigurableHashingInterceptor"
);
         bean.setHashAlgorithm( "SSHA-256" );
-        List<String> hashAttributes = new ArrayList<>();
-        hashAttributes.add( "userPassword" );
-        hashAttributes.add( "cn" ); // why would i do this?... to test...
-        bean.setHashAttributes( hashAttributes );
+        bean.addHashAttributes( 
+                new String[] {
+                    schemaManager.getAttributeType( "userPassword" ).getOid(),
+                    schemaManager.getAttributeType( "cn" ).getOid(),
+                });
         
         List<InterceptorBean> interceptorBeans = new ArrayList<>();
         interceptorBeans.add( bean );



Mime
View raw message