FrankChen021 commented on code in PR #20222:
URL: https://github.com/apache/druid/pull/20222#discussion_r3914075455


##########
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/Pac4jFilterTest.java:
##########
@@ -196,4 +202,32 @@ public void testFilterCreation()
     Pac4jFilter filter = new Pac4jFilter("testName", "testAuthorizer", 
pac4jConfig, "/test-callback", "testPassphrase");
     Assertions.assertNotNull(filter);
   }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testAuthenticationResultContainsProfileAttributes()
+  {
+    // Verify that the AuthenticationResult context is populated with profile 
attributes,
+    // so downstream authorizers (e.g. OPA) can make group-based access 
decisions.
+    List<String> groups = Arrays.asList("group-a", "group-b");
+
+    CommonProfile profile = new CommonProfile();
+    profile.setId("test-user-id");
+    profile.addAttribute("groups", groups);
+    profile.addAttribute("email", "[email protected]");
+
+    Map<String, Object> authContext = Collections.singletonMap(

Review Comment:
   [P2] Test does not exercise Pac4jFilter
   
   The test manually constructs the same AuthenticationResult context it 
asserts, without invoking Pac4jFilter or its success callback. It therefore 
passes even if Pac4jFilter still supplies null or an incorrect context, leaving 
the PR's primary regression fix unprotected. Drive an authenticated profile 
through doFilter (or add a controllable test seam/integration test) and capture 
the request attribute.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to