C0urante commented on a change in pull request #9987: URL: https://github.com/apache/kafka/pull/9987#discussion_r566305048
########## File path: connect/basic-auth-extension/src/main/java/org/apache/kafka/connect/rest/basic/auth/extension/BasicAuthSecurityRestExtension.java ########## @@ -80,7 +95,8 @@ public void close() throws IOException { @Override public void configure(Map<String, ?> configs) { - + // If we failed to retrieve a JAAS configuration during startup, throw that exception now + CONFIGURATION.get(); Review comment: Ack, done. ########## File path: connect/basic-auth-extension/src/test/java/org/apache/kafka/connect/rest/basic/auth/extension/BasicAuthSecurityRestExtensionTest.java ########## @@ -63,4 +69,25 @@ public void testJaasConfigurationNotOverwritten() { assertNotEquals(overwrittenConfiguration, jaasFilter.getValue().configuration, "Overwritten JAAS configuration should not be used by basic auth REST extension"); } + + @Test + public void testBadJaasConfiguration() { + SecurityException jaasConfigurationException = new SecurityException(new IOException("Bad JAAS config is bad")); + Supplier<Configuration> configuration = BasicAuthSecurityRestExtension.initializeConfiguration(() -> { + throw jaasConfigurationException; + }); + + ConnectException thrownException = assertThrows(ConnectException.class, configuration::get); + assertEquals(jaasConfigurationException, thrownException.getCause()); + } + + @Test + public void testGoodJaasConfiguration() { + Configuration mockConfiguration = EasyMock.mock(Configuration.class); Review comment: Not sure if you really meant evaluating `mockConfiguration`, or perhaps just validating that the wrapping `Supplier<Configuration>` was evaluated... I added a test case for the latter; LMKWYT. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org