directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r612927 - in /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn: LdapPrincipal.java SimpleAuthenticator.java
Date Thu, 17 Jan 2008 18:38:58 GMT
Author: elecharny
Date: Thu Jan 17 10:38:57 2008
New Revision: 612927

URL: http://svn.apache.org/viewvc?rev=612927&view=rev
Log:
Some more Attributes removal

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java?rev=612927&r1=612926&r2=612927&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
Thu Jan 17 10:38:57 2008
@@ -23,8 +23,6 @@
 import java.io.Serializable;
 import java.security.Principal;
 
-import javax.naming.Name;
-
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=612927&r1=612926&r2=612927&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
Thu Jan 17 10:38:57 2008
@@ -32,8 +32,6 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 
 import org.apache.commons.collections.map.LRUMap;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -50,6 +48,11 @@
 import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.subtree.SubentryInterceptor;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerStringValue;
+import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.trigger.TriggerInterceptor;
 import org.apache.directory.server.schema.registries.Registries;
@@ -579,14 +582,17 @@
         // ---- lookup the principal entry's userPassword attribute
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes userEntry;
+        ServerEntry userEntry;
 
         try
         {
             LookupOperationContext lookupContex  = new LookupOperationContext( registries,
new String[] { SchemaConstants.USER_PASSWORD_AT } );
             lookupContex.setDn( principalDn );
             
-            userEntry = proxy.lookup( lookupContex, USERLOOKUP_BYPASS );
+            userEntry = ServerEntryUtils.toServerEntry( 
+                proxy.lookup( lookupContex, USERLOOKUP_BYPASS ), 
+                principalDn,
+                registries );
 
             if ( userEntry == null )
             {
@@ -601,26 +607,28 @@
             throw e;
         }
 
-        Object userPassword;
+        ServerValue<?> userPassword;
 
-        Attribute userPasswordAttr = userEntry.get( SchemaConstants.USER_PASSWORD_AT );
+        ServerAttribute userPasswordAttr = userEntry.get( SchemaConstants.USER_PASSWORD_AT
);
 
         // ---- assert that credentials match
         if ( userPasswordAttr == null )
         {
-            userPassword = ArrayUtils.EMPTY_BYTE_ARRAY;
+            return StringTools.EMPTY_BYTES;
         }
         else
         {
             userPassword = userPasswordAttr.get();
 
-            if ( userPassword instanceof String )
+            if ( userPassword instanceof ServerStringValue )
             {
-                userPassword = StringTools.getBytesUtf8( ( String ) userPassword );
+                return StringTools.getBytesUtf8( (String)userPassword.get() );
+            }
+            else
+            {
+                return (byte[])userPassword.get();
             }
         }
-        
-        return ( byte[] ) userPassword;
     }
 
     /**



Mime
View raw message