use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class YamlClientConfigBuilderTest method testSecurityConfig_onlyFactory.
@Override
@Test
public void testSecurityConfig_onlyFactory() {
String yaml = "" + "hazelcast-client:\n" + " security:\n" + " credentials-factory:\n" + " class-name: com.hazelcast.examples.MyCredentialsFactory\n" + " properties:\n" + " property: value";
ClientConfig config = buildConfig(yaml);
ClientSecurityConfig securityConfig = config.getSecurityConfig();
CredentialsFactoryConfig credentialsFactoryConfig = securityConfig.getCredentialsFactoryConfig();
assertEquals("com.hazelcast.examples.MyCredentialsFactory", credentialsFactoryConfig.getClassName());
Properties properties = credentialsFactoryConfig.getProperties();
assertEquals("value", properties.getProperty("property"));
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class XmlClientConfigBuilderTest method testSecurityConfig_onlyFactory.
@Override
@Test
public void testSecurityConfig_onlyFactory() {
String xml = HAZELCAST_CLIENT_START_TAG + " <security>\n" + " <credentials-factory class-name=\"com.hazelcast.examples.MyCredentialsFactory\">\n" + " <properties>\n" + " <property name=\"property\">value</property>\n" + " </properties>\n" + " </credentials-factory>\n" + " </security>" + HAZELCAST_CLIENT_END_TAG;
ClientConfig config = buildConfig(xml);
ClientSecurityConfig securityConfig = config.getSecurityConfig();
CredentialsFactoryConfig credentialsFactoryConfig = securityConfig.getCredentialsFactoryConfig();
assertEquals("com.hazelcast.examples.MyCredentialsFactory", credentialsFactoryConfig.getClassName());
Properties properties = credentialsFactoryConfig.getProperties();
assertEquals("value", properties.getProperty("property"));
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class AbstractClientConfigBuilderTest method testSecurityConfig.
@Test
public void testSecurityConfig() {
ClientSecurityConfig securityConfig = fullClientConfig.getSecurityConfig();
assertNull(securityConfig.getUsernamePasswordIdentityConfig());
CredentialsFactoryConfig credentialsFactoryConfig = securityConfig.getCredentialsFactoryConfig();
assertEquals("com.hazelcast.examples.MyCredentialsFactory", credentialsFactoryConfig.getClassName());
Properties properties = credentialsFactoryConfig.getProperties();
assertEquals("value", properties.getProperty("property"));
RealmConfig realmConfig = securityConfig.getRealmConfig("krb5Initiator");
assertNotNull(realmConfig);
JaasAuthenticationConfig jaasConf = realmConfig.getJaasAuthenticationConfig();
assertNotNull(jaasConf);
List<LoginModuleConfig> loginModuleConfigs = jaasConf.getLoginModuleConfigs();
assertNotNull(loginModuleConfigs);
assertEquals(1, loginModuleConfigs.size());
LoginModuleConfig loginModuleConfig = loginModuleConfigs.get(0);
assertEquals("com.sun.security.auth.module.Krb5LoginModule", loginModuleConfig.getClassName());
assertEquals(LoginModuleUsage.REQUIRED, loginModuleConfig.getUsage());
assertEquals("jduke@HAZELCAST.COM", loginModuleConfig.getProperties().get("principal"));
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method handleCredentialsFactory.
private void handleCredentialsFactory(RealmConfig realmConfig, Node node) {
String className = getAttribute(node, "class-name");
CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig(className);
realmConfig.setCredentialsFactoryConfig(credentialsFactoryConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if (matches("properties", nodeName)) {
fillProperties(child, credentialsFactoryConfig.getProperties());
}
}
}
Aggregations