From f85296104c1cb692c85b2f779fe9163460d8b5d1 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Mon, 26 Jan 2009 16:53:12 +0000 Subject: QPID-1533 : Patch from Robert Gemmell, Fixes the reload tab in UserManagement to actually reload the PrincipalDatabase file from disk. Not just the jmxaccess rights file. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@737746 13f79535-47bb-0310-9956-ffa450edef68 --- .../access/management/AMQUserManagementMBean.java | 16 ++++++---------- .../database/Base64MD5PasswordFilePrincipalDatabase.java | 5 +++++ .../database/PlainPasswordFilePrincipalDatabase.java | 5 +++++ .../server/security/auth/database/PrincipalDatabase.java | 5 +++++ .../auth/database/PropertiesPrincipalDatabase.java | 5 +++++ .../server/security/auth/sasl/TestPrincipalDatabase.java | 5 +++++ 6 files changed, 31 insertions(+), 10 deletions(-) (limited to 'java/broker') diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java index 7ff3bd3541..f04aecd0a5 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java @@ -226,27 +226,23 @@ public class AMQUserManagementMBean extends AMQManagedObject implements UserMana public boolean reloadData() { - try - { try { loadAccessFile(); + _principalDatabase.reload(); } catch (ConfigurationException e) { _logger.info("Reload failed due to:" + e); return false; } - + catch (IOException e) + { + _logger.info("Reload failed due to:" + e); + return false; + } // Reload successful return true; - } - catch (IOException e) - { - _logger.info("Reload failed due to:" + e); - // Reload unsuccessful - return false; - } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java index bf459542de..69ad9014db 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java @@ -492,4 +492,9 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase } } + public void reload() throws IOException + { + loadPasswordFile(); + } + } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java index 352d41a0ba..9da954d74f 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java @@ -237,4 +237,9 @@ public class PlainPasswordFilePrincipalDatabase implements PrincipalDatabase } } } + + public void reload() throws IOException + { + //This PD is not cached, so do nothing. + } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java index a82f9ed40b..ef37e043a6 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabase.java @@ -92,6 +92,11 @@ public interface PrincipalDatabase */ Principal getUser(String username); + /** + * Reload the database to its ensure contents are up to date + * @throws IOException If there was an error reloading the database + */ + void reload() throws IOException; public Map getMechanisms(); diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java index c8a4add0f1..ff8851306f 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java @@ -161,4 +161,9 @@ public class PropertiesPrincipalDatabase implements PrincipalDatabase return null; } } + + public void reload() throws IOException + { + //No file to update from, so do nothing. + } } diff --git a/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/TestPrincipalDatabase.java b/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/TestPrincipalDatabase.java index a87c727a9a..8507e49e17 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/TestPrincipalDatabase.java +++ b/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/TestPrincipalDatabase.java @@ -83,4 +83,9 @@ public class TestPrincipalDatabase implements PrincipalDatabase return false; } + public void reload() throws IOException + { + // TODO Auto-generated method stub + } + } -- cgit v1.2.1