You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/11/01 17:21:22 UTC

svn commit: r1767524 - in /qpid/java/trunk/broker-core/src: main/java/org/apache/qpid/server/security/auth/manager/ test/java/org/apache/qpid/server/security/auth/manager/

Author: orudyy
Date: Tue Nov  1 17:21:22 2016
New Revision: 1767524

URL: http://svn.apache.org/viewvc?rev=1767524&view=rev
Log:
QPID-7485: Revert redundant check on changing of path attribute in file based authentication providers

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
    qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java?rev=1767524&r1=1767523&r2=1767524&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java Tue Nov  1 17:21:22 2016
@@ -374,23 +374,6 @@ public abstract class PrincipalDatabaseA
         {
             throw new IllegalConfigurationException("Changing the type of authentication provider is not supported");
         }
-
-        if (changedAttributes.contains(PATH) && !updated.getPath().equals(getPath()))
-        {
-            PrincipalDatabase db = createDatabase();
-            try
-            {
-                db.open(new File(updated.getPath()));
-            }
-            catch (FileNotFoundException e)
-            {
-                throw new IllegalConfigurationException("User database does not exists at specified location : " + e.getMessage(), e);
-            }
-            catch (IOException e)
-            {
-                throw new IllegalConfigurationException("Cannot use password database at :" + _path, e);
-            }
-        }
     }
 
     @Override

Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java?rev=1767524&r1=1767523&r2=1767524&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java (original)
+++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java Tue Nov  1 17:21:22 2016
@@ -27,7 +27,6 @@ import static org.mockito.Mockito.when;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
-import java.io.IOException;
 import java.security.Principal;
 import java.util.Collections;
 import java.util.HashMap;
@@ -148,16 +147,6 @@ public class PrincipalDatabaseAuthentica
         _principalDatabase = new PlainPasswordFilePrincipalDatabase(mockAuthProvider);
         setupManager(true);
 
-        createPasswordFile();
-        _manager.initialise();
-        List<Principal> users = _principalDatabase.getUsers();
-        assertEquals("Unexpected uses size", 1, users.size());
-        Principal p = _principalDatabase.getUser("admin");
-        assertEquals("Unexpected principal name", "admin", p.getName());
-    }
-
-    private void createPasswordFile() throws IOException
-    {
         File f = new File(_passwordFileLocation);
         f.createNewFile();
         FileOutputStream fos = null;
@@ -173,32 +162,11 @@ public class PrincipalDatabaseAuthentica
                 fos.close();
             }
         }
-    }
-
-    public void testChangePathToNonExistentFile() throws Exception
-    {
-        AuthenticationProvider mockAuthProvider = mock(AuthenticationProvider.class);
-        when(mockAuthProvider.getContextValue(Integer.class, AbstractScramAuthenticationManager.QPID_AUTHMANAGER_SCRAM_ITERATION_COUNT)).thenReturn(4096);
-        _principalDatabase = new PlainPasswordFilePrincipalDatabase(mockAuthProvider);
-        setupManager(true);
-
-        createPasswordFile();
         _manager.initialise();
-
-        File file = new File(_passwordFileLocation + System.currentTimeMillis());
-        assertFalse("Password file should not exist", file.exists());
-
-        try
-        {
-            _manager.setAttributes(Collections.singletonMap(PrincipalDatabaseAuthenticationManager.PATH,
-                                                               file.getAbsoluteFile()));
-            fail("Changing password file location to nonexisting file should not be allowed");
-        }
-        catch (IllegalConfigurationException e)
-        {
-            // pass
-        }
-
+        List<Principal> users = _principalDatabase.getUsers();
+        assertEquals("Unexpected uses size", 1, users.size());
+        Principal p = _principalDatabase.getUser("admin");
+        assertEquals("Unexpected principal name", "admin", p.getName());
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org