You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "jbertram (via GitHub)" <gi...@apache.org> on 2023/05/25 23:08:16 UTC

[GitHub] [activemq-artemis] jbertram opened a new pull request, #4488: ARTEMIS-4293 add mngmnt ops to clear authn/z caches

jbertram opened a new pull request, #4488:
URL: https://github.com/apache/activemq-artemis/pull/4488

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [activemq-artemis] rvais commented on a diff in pull request #4488: ARTEMIS-4293 add mngmnt ops to clear authn/z caches

Posted by "rvais (via GitHub)" <gi...@apache.org>.
rvais commented on code in PR #4488:
URL: https://github.com/apache/activemq-artemis/pull/4488#discussion_r1262352459


##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java:
##########
@@ -257,6 +257,32 @@ public void testSecurityCacheSizes() throws Exception {
       Wait.assertEquals(usingCore() ? 8 : 1, () -> serverControl.getAuthorizationCacheSize());
    }
 
+   @Test
+   public void testClearingSecurityCaches() throws Exception {
+      ActiveMQServerControl serverControl = createManagementControl();
+
+      ServerLocator loc = createInVMNonHALocator();
+      ClientSessionFactory csf = createSessionFactory(loc);
+      ClientSession session = csf.createSession("myUser", "myPass", false, true, false, false, 0);
+      session.start();
+
+      final String address = "ADDRESS";
+      serverControl.createAddress(address, "MULTICAST");
+      ClientProducer producer = session.createProducer(address);
+      ClientMessage m = session.createMessage(true);
+      m.putStringProperty("hello", "world");
+      producer.send(m);
+
+      Assert.assertTrue(serverControl.getAuthenticationCacheSize() > 0);
+      Wait.assertTrue(() -> serverControl.getAuthorizationCacheSize() > 0);
+
+      serverControl.clearAuthenticationCache();
+      serverControl.clearAuthorizationCache();
+
+      Assert.assertEquals(usingCore() ? 1 : 0, serverControl.getAuthenticationCacheSize());

Review Comment:
   I am unsure what this assertion actually does...?!  Test doesn't seem to be parametrized and doesn't seem to contain anything that would influence the return value of "usingCore" method. If the return value doesn't change, why the ternal operator is used in the first place? The same applies for the condition below. What these actually assert?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [activemq-artemis] brusdev merged pull request #4488: ARTEMIS-4293 add mngmnt ops to clear authn/z caches

Posted by "brusdev (via GitHub)" <gi...@apache.org>.
brusdev merged PR #4488:
URL: https://github.com/apache/activemq-artemis/pull/4488


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [activemq-artemis] jbertram commented on a diff in pull request #4488: ARTEMIS-4293 add mngmnt ops to clear authn/z caches

Posted by "jbertram (via GitHub)" <gi...@apache.org>.
jbertram commented on code in PR #4488:
URL: https://github.com/apache/activemq-artemis/pull/4488#discussion_r1262647465


##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java:
##########
@@ -257,6 +257,32 @@ public void testSecurityCacheSizes() throws Exception {
       Wait.assertEquals(usingCore() ? 8 : 1, () -> serverControl.getAuthorizationCacheSize());
    }
 
+   @Test
+   public void testClearingSecurityCaches() throws Exception {
+      ActiveMQServerControl serverControl = createManagementControl();
+
+      ServerLocator loc = createInVMNonHALocator();
+      ClientSessionFactory csf = createSessionFactory(loc);
+      ClientSession session = csf.createSession("myUser", "myPass", false, true, false, false, 0);
+      session.start();
+
+      final String address = "ADDRESS";
+      serverControl.createAddress(address, "MULTICAST");
+      ClientProducer producer = session.createProducer(address);
+      ClientMessage m = session.createMessage(true);
+      m.putStringProperty("hello", "world");
+      producer.send(m);
+
+      Assert.assertTrue(serverControl.getAuthenticationCacheSize() > 0);
+      Wait.assertTrue(() -> serverControl.getAuthorizationCacheSize() > 0);
+
+      serverControl.clearAuthenticationCache();
+      serverControl.clearAuthorizationCache();
+
+      Assert.assertEquals(usingCore() ? 1 : 0, serverControl.getAuthenticationCacheSize());

Review Comment:
   The `usingCore()` method is implemented by:
   
    - `org.apache.activemq.artemis.tests.integration.management.ActiveMQServerControlTest` (returns `false`)
    - `org.apache.activemq.artemis.tests.integration.management.ActiveMQServerControlUsingCoreTest` (returns `true`)
   
   This method is meant to indicate when core _messages_ are being used for management rather than JMX. Using core requires an extra connection so the management messages can be sent. This extra connection (and everything that goes with it like authentications and authorizations) need to be ignored so that the same tests work with or without core.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org