use of org.apache.kafka.common.security.authenticator.TestJaasConfig in project apache-kafka-on-k8s by banzaicloud.
the class PlainSaslServerTest method setUp.
@Before
public void setUp() throws Exception {
TestJaasConfig jaasConfig = new TestJaasConfig();
Map<String, Object> options = new HashMap<>();
options.put("user_" + USER_A, PASSWORD_A);
options.put("user_" + USER_B, PASSWORD_B);
jaasConfig.addEntry("jaasContext", PlainLoginModule.class.getName(), options);
JaasContext jaasContext = new JaasContext("jaasContext", JaasContext.Type.SERVER, jaasConfig, null);
saslServer = new PlainSaslServer(jaasContext);
}
use of org.apache.kafka.common.security.authenticator.TestJaasConfig in project apache-kafka-on-k8s by banzaicloud.
the class SaslChannelBuilderTest method createChannelBuilder.
private SaslChannelBuilder createChannelBuilder(SecurityProtocol securityProtocol) {
TestJaasConfig jaasConfig = new TestJaasConfig();
jaasConfig.addEntry("jaasContext", PlainLoginModule.class.getName(), new HashMap<String, Object>());
JaasContext jaasContext = new JaasContext("jaasContext", JaasContext.Type.SERVER, jaasConfig, null);
Map<String, JaasContext> jaasContexts = Collections.singletonMap("PLAIN", jaasContext);
return new SaslChannelBuilder(Mode.CLIENT, jaasContexts, securityProtocol, new ListenerName("PLAIN"), false, "PLAIN", true, null, null);
}
use of org.apache.kafka.common.security.authenticator.TestJaasConfig in project kafka by apache.
the class OAuthBearerTest method configureHandler.
protected void configureHandler(AuthenticateCallbackHandler handler, Map<String, ?> configs, Map<String, Object> jaasConfig) {
TestJaasConfig config = new TestJaasConfig();
config.createOrUpdateEntry("KafkaClient", OAuthBearerLoginModule.class.getName(), jaasConfig);
AppConfigurationEntry kafkaClient = config.getAppConfigurationEntry("KafkaClient")[0];
handler.configure(configs, OAuthBearerLoginModule.OAUTHBEARER_MECHANISM, Collections.singletonList(kafkaClient));
}
use of org.apache.kafka.common.security.authenticator.TestJaasConfig in project kafka by apache.
the class PlainSaslServerTest method setUp.
@BeforeEach
public void setUp() {
TestJaasConfig jaasConfig = new TestJaasConfig();
Map<String, Object> options = new HashMap<>();
options.put("user_" + USER_A, PASSWORD_A);
options.put("user_" + USER_B, PASSWORD_B);
jaasConfig.addEntry("jaasContext", PlainLoginModule.class.getName(), options);
JaasContext jaasContext = new JaasContext("jaasContext", JaasContext.Type.SERVER, jaasConfig, null);
PlainServerCallbackHandler callbackHandler = new PlainServerCallbackHandler();
callbackHandler.configure(null, "PLAIN", jaasContext.configurationEntries());
saslServer = new PlainSaslServer(callbackHandler);
}
use of org.apache.kafka.common.security.authenticator.TestJaasConfig in project kafka by apache.
the class JaasBasicAuthFilterTest method setupJaasFilter.
private JaasBasicAuthFilter setupJaasFilter(String name, String credentialFilePath) {
TestJaasConfig configuration = new TestJaasConfig();
Map<String, Object> moduleOptions = credentialFilePath != null ? Collections.singletonMap("file", credentialFilePath) : Collections.emptyMap();
configuration.addEntry(name, LOGIN_MODULE, moduleOptions);
return new JaasBasicAuthFilter(configuration);
}
Aggregations