You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/08/16 12:10:44 UTC

svn commit: r985854 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java

Author: kayyagari
Date: Mon Aug 16 10:10:44 2010
New Revision: 985854

URL: http://svn.apache.org/viewvc?rev=985854&view=rev
Log:
o fix for DIRSERVER-1540

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=985854&r1=985853&r2=985854&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Mon Aug 16 10:10:44 2010
@@ -293,18 +293,6 @@ public class SimpleAuthenticator extends
         // Get the stored password, either from cache or from backend
         byte[] storedPassword = principal.getUserPassword();
 
-        // Short circuit for PLAIN TEXT passwords : we compare the byte array directly
-        // Are the passwords equal ?
-        if ( Arrays.equals( credentials, storedPassword ) )
-        {
-            if ( IS_DEBUG )
-            {
-                LOG.debug( "{} Authenticated", bindContext.getDn() );
-            }
-
-            return principal;
-        }
-
         // Let's see if the stored password was encrypted
         LdapSecurityConstants algorithm = PasswordUtil.findAlgorithm( storedPassword );
 
@@ -343,10 +331,24 @@ public class SimpleAuthenticator extends
         }
         else
         {
-            // Bad password ...
-            String message = I18n.err( I18n.ERR_230, bindContext.getDn().getName() );
-            LOG.info( message );
-            throw new LdapAuthenticationException( message );
+            // PLAIN TEXT passwords : we compare the byte array directly
+            // Are the passwords equal ?
+            if ( Arrays.equals( credentials, storedPassword ) )
+            {
+                if ( IS_DEBUG )
+                {
+                    LOG.debug( "{} Authenticated", bindContext.getDn() );
+                }
+
+                return principal;
+            }
+            else
+            {
+                // Bad password ...
+                String message = I18n.err( I18n.ERR_230, bindContext.getDn().getName() );
+                LOG.info( message );
+                throw new LdapAuthenticationException( message );
+            }
         }
     }