qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1649587 - in /qpid/trunk/qpid/java: broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java systests/src/test/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
Date Mon, 05 Jan 2015 16:45:58 GMT
Author: rgodfrey
Date: Mon Jan  5 16:45:58 2015
New Revision: 1649587

URL: http://svn.apache.org/r1649587
Log:
QPID-6295 : [Java Broker] reload ACL config when the file value is changed

Modified:
    qpid/trunk/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java
    qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java

Modified: qpid/trunk/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java?rev=1649587&r1=1649586&r2=1649587&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java
(original)
+++ qpid/trunk/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java
Mon Jan  5 16:45:58 2015
@@ -55,7 +55,7 @@ public class ACLFileAccessControlProvide
     protected DefaultAccessControl _accessControl;
     protected final Broker _broker;
 
-    @ManagedAttributeField
+    @ManagedAttributeField( afterSet = "reloadAclFile")
     private String _path;
 
     @ManagedObjectFactoryConstructor
@@ -100,7 +100,6 @@ public class ACLFileAccessControlProvide
         }
         catch(RuntimeException e)
         {
-            e.printStackTrace();
             throw new IllegalConfigurationException(e.getMessage(), e);
         }
         finally
@@ -119,6 +118,26 @@ public class ACLFileAccessControlProvide
         _accessControl = new DefaultAccessControl(getPath(), _broker);
     }
 
+    @SuppressWarnings("unused")
+    private void reloadAclFile()
+    {
+        try
+        {
+            DefaultAccessControl accessControl = new DefaultAccessControl(getPath(), _broker);
+            accessControl.open();
+            DefaultAccessControl oldAccessControl = _accessControl;
+            _accessControl = accessControl;
+            if(oldAccessControl != null)
+            {
+                oldAccessControl.close();
+            }
+        }
+        catch(RuntimeException e)
+        {
+            throw new IllegalConfigurationException(e.getMessage(), e);
+        }
+    }
+
     @Override
     public String getPath()
     {

Modified: qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java?rev=1649587&r1=1649586&r2=1649587&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
Mon Jan  5 16:45:58 2015
@@ -795,10 +795,11 @@ public class BrokerACLTest extends QpidR
 
         assertAccessControlProviderExistence(accessControlProviderName, true);
 
+        File aclFile = TestFileUtils.createTempFile(this, ".acl", "ACL ALLOW all all");
+
         Map<String, Object> attributes = new HashMap<String, Object>();
-        attributes.put(GroupProvider.NAME, accessControlProviderName);
-        attributes.put(GroupProvider.TYPE, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE);
-        attributes.put(FileBasedGroupProvider.PATH, "/path/to/file");
+        attributes.put(AccessControlProvider.NAME, accessControlProviderName);
+        attributes.put(FileBasedGroupProvider.PATH, aclFile.getAbsolutePath());
         responseCode = getRestTestHelper().submitRequest("accesscontrolprovider/" + accessControlProviderName,
"PUT", attributes);
         assertEquals("Setting of access control provider attributes should be allowed", 200,
responseCode);
     }



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


Mime
View raw message