directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r558089 - in /directory/apacheds/trunk: core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
Date Fri, 20 Jul 2007 18:49:46 GMT
Author: ersiner
Date: Fri Jul 20 11:49:45 2007
New Revision: 558089

URL: http://svn.apache.org/viewvc?view=rev&rev=558089
Log:
Fixed DIRSERVER-1001.

Modified:
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java?view=diff&rev=558089&r1=558088&r2=558089
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
Fri Jul 20 11:49:45 2007
@@ -649,4 +649,47 @@
         assertNotNull( attrs );
         assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
     }
+    
+    /**
+     * @see https://issues.apache.org/jira/browse/DIRSERVER-1001
+     */
+    public void testInvalidateCredentialCacheForUpdatingAnotherUsersPassword() throws NamingException
+    {
+        // bind as akarasulu
+        Hashtable<String,Object> envUser = new Hashtable<String,Object>( configuration.toJndiEnvironment()
);
+        envUser.put( Context.PROVIDER_URL, "ou=system" );
+        envUser.put( Context.SECURITY_PRINCIPAL, "uid=akarasulu,ou=users,ou=system" );
+        envUser.put( Context.SECURITY_CREDENTIALS, "test" );
+        envUser.put( Context.SECURITY_AUTHENTICATION, "simple" );
+        envUser.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+        InitialDirContext idcUer = new InitialDirContext( envUser );
+        idcUer.close();
+        
+        // bind as admin
+        Hashtable<String,Object> envAdmin = new Hashtable<String,Object>( configuration.toJndiEnvironment()
);
+        envAdmin.put( Context.PROVIDER_URL, "ou=system" );
+        envAdmin.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+        envAdmin.put( Context.SECURITY_CREDENTIALS, "secret" );
+        envAdmin.put( Context.SECURITY_AUTHENTICATION, "simple" );
+        envAdmin.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory"
);
+        InitialDirContext idcAdmin = new InitialDirContext( envAdmin );
+        
+        // now modify the password for akarasulu (while we're admin)
+        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "newpwd"
);
+        idcAdmin.modifyAttributes( "uid=akarasulu,ou=users", new ModificationItemImpl[] {

+            new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
+        idcAdmin.close();
+        
+        // try to bind as akarasulu with old password
+        envUser.put( Context.SECURITY_CREDENTIALS, "test" );
+        try
+        {
+            idcUer = new InitialDirContext( envUser );
+            fail( "Authentication with old password should fail" );
+        }
+        catch ( NamingException e )
+        {
+            // we should fail
+        }
+    }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?view=diff&rev=558089&r1=558088&r2=558089
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
Fri Jul 20 11:49:45 2007
@@ -376,7 +376,7 @@
             // try each authenticator
             for ( Authenticator authenticator:authenticators )
             {
-                authenticator.invalidateCache( getPrincipal().getJndiName() );
+                authenticator.invalidateCache( principalDn );
             }
         }
     }



Mime
View raw message