FrankChen021 commented on code in PR #20222:
URL: https://github.com/apache/druid/pull/20222#discussion_r3924866526
##########
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/Pac4jFilterTest.java:
##########
@@ -196,4 +205,48 @@ public void testFilterCreation()
Pac4jFilter filter = new Pac4jFilter("testName", "testAuthorizer",
pac4jConfig, "/test-callback", "testPassphrase");
Assertions.assertNotNull(filter);
}
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testDoFilterSetsProfileAttributesInAuthenticationResult() throws
IOException, ServletException
+ {
+ 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]");
+
+ SecurityLogic stubbedSecurityLogic = (ctx, ss, config, adapter,
actionAdapter, clients, authorizers, matchers, params) ->
+ adapter.adapt(ctx, ss, Collections.singletonList(profile));
Review Comment:
[P1] Handle the checked adapter exception
This callback is passed to pac4j's SecurityLogic.perform, whose functional
interface does not permit checked exceptions, but adapter.adapt(...) declares
throws Exception. The lambda therefore cannot compile. Catch the checked
exception in the callback and rethrow it as an unchecked exception, or use a
callback type that permits it.
--
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]