aljoscha commented on a change in pull request #10836: [FLINK-11589][Security] Support security module and context discovery via ServiceLoader URL: https://github.com/apache/flink/pull/10836#discussion_r374734280
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/security/SecurityUtils.java ########## @@ -56,43 +56,42 @@ public static SecurityContext getInstalledContext() { * <p>Applies the configuration using the available security modules (i.e. Hadoop, JAAS). */ public static void install(SecurityConfiguration config) throws Exception { + // Install the security modules first before installing the security context + installModules(config); + installContext(config); + } + + static void installModules(SecurityConfiguration config) throws Exception { - // install the security modules + // install the security module factories List<SecurityModule> modules = new ArrayList<>(); try { - for (SecurityModuleFactory moduleFactory : config.getSecurityModuleFactories()) { + for (String moduleFactoryClass : config.getSecurityModuleFactories()) { + SecurityModuleFactory moduleFactory = SecurityFactoryService.findModuleFactory(moduleFactoryClass); + if (moduleFactory == null) { Review comment: I think the service loader will throw an exception if it cannot find a factory, it will not return `null`. ---------------------------------------------------------------- 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 With regards, Apache Git Services