Search in sources :

Example 1 with JaasModuleFactory

use of org.apache.flink.runtime.security.modules.JaasModuleFactory in project flink by apache.

the class TestingSecurityContext method install.

public static void install(SecurityConfiguration config, Map<String, ClientSecurityConfiguration> clientSecurityConfigurationMap) throws Exception {
    SecurityUtils.install(config);
    // install dynamic JAAS entries
    for (String factoryClassName : config.getSecurityModuleFactories()) {
        SecurityModuleFactory factory = SecurityFactoryServiceLoader.findModuleFactory(factoryClassName);
        if (factory instanceof JaasModuleFactory) {
            DynamicConfiguration jaasConf = (DynamicConfiguration) javax.security.auth.login.Configuration.getConfiguration();
            for (Map.Entry<String, ClientSecurityConfiguration> e : clientSecurityConfigurationMap.entrySet()) {
                AppConfigurationEntry entry = KerberosUtils.keytabEntry(e.getValue().getKeytab(), e.getValue().getPrincipal());
                jaasConf.addAppConfigurationEntry(e.getKey(), entry);
            }
            break;
        }
    }
}
Also used : AppConfigurationEntry(javax.security.auth.login.AppConfigurationEntry) SecurityModuleFactory(org.apache.flink.runtime.security.modules.SecurityModuleFactory) DynamicConfiguration(org.apache.flink.runtime.security.DynamicConfiguration) JaasModuleFactory(org.apache.flink.runtime.security.modules.JaasModuleFactory) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 AppConfigurationEntry (javax.security.auth.login.AppConfigurationEntry)1 DynamicConfiguration (org.apache.flink.runtime.security.DynamicConfiguration)1 JaasModuleFactory (org.apache.flink.runtime.security.modules.JaasModuleFactory)1 SecurityModuleFactory (org.apache.flink.runtime.security.modules.SecurityModuleFactory)1