use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class SecureApplicationContextTest method testMemberRealm.
@Test
public void testMemberRealm() {
RealmConfig realmConfig = securityConfig.getRealmConfig(securityConfig.getMemberRealm());
JaasAuthenticationConfig jaasAuthenticationConfig = realmConfig.getJaasAuthenticationConfig();
assertNotNull(jaasAuthenticationConfig);
List<LoginModuleConfig> list = jaasAuthenticationConfig.getLoginModuleConfigs();
assertEquals(1, list.size());
LoginModuleConfig lm = list.get(0);
assertEquals("com.hazelcast.examples.MyRequiredLoginModule", lm.getClassName());
assertFalse(lm.getProperties().isEmpty());
assertEquals(LoginModuleUsage.REQUIRED, lm.getUsage());
CredentialsFactoryConfig credentialsFactoryConfig = realmConfig.getCredentialsFactoryConfig();
assertNotNull(credentialsFactoryConfig);
assertEquals(dummyCredentialsFactory, credentialsFactoryConfig.getImplementation());
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class ClientConfigXmlGenerator method security.
private static void security(XmlGenerator gen, ClientSecurityConfig security) {
if (security == null) {
return;
}
gen.open("security");
UsernamePasswordIdentityConfig upConfig = security.getUsernamePasswordIdentityConfig();
if (upConfig != null) {
gen.node("username-password", null, "username", upConfig.getUsername(), "password", upConfig.getPassword());
}
TokenIdentityConfig tic = security.getTokenIdentityConfig();
if (tic != null) {
gen.node("token", tic.getTokenEncoded(), "encoding", tic.getEncoding());
}
CredentialsFactoryConfig cfConfig = security.getCredentialsFactoryConfig();
if (cfConfig != null) {
gen.open("credentials-factory", "class-name", cfConfig.getClassName()).appendProperties(cfConfig.getProperties()).close();
}
kerberosIdentityGenerator(gen, security.getKerberosIdentityConfig());
Map<String, RealmConfig> realms = security.getRealmConfigs();
if (realms != null && !realms.isEmpty()) {
gen.open("realms");
for (Map.Entry<String, RealmConfig> realmEntry : realms.entrySet()) {
securityRealmGenerator(gen, realmEntry.getKey(), realmEntry.getValue());
}
gen.close();
}
gen.close();
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class ClientDomConfigProcessor method handleCredentialsFactory.
private void handleCredentialsFactory(Node node, ClientSecurityConfig clientSecurityConfig) {
Node classNameNode = getNamedItemNode(node, "class-name");
String className = getTextContent(classNameNode);
CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig(className);
clientSecurityConfig.setCredentialsFactoryConfig(credentialsFactoryConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if (matches("properties", nodeName)) {
fillProperties(child, credentialsFactoryConfig.getProperties());
break;
}
}
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class FailoverConfigTest method testClientConfigWith_withAValidChange.
@Test
public void testClientConfigWith_withAValidChange() {
ClientFailoverConfig clientFailoverConfig = new ClientFailoverConfig();
clientFailoverConfig.addClientConfig(new ClientConfig());
ClientConfig alternativeConfig = new ClientConfig();
alternativeConfig.setClusterName("alternative");
CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig();
credentialsFactoryConfig.setClassName("CustomCredentials");
alternativeConfig.getSecurityConfig().setCredentialsFactoryConfig(credentialsFactoryConfig);
clientFailoverConfig.addClientConfig(alternativeConfig);
resolveClientFailoverConfig(clientFailoverConfig);
}
use of com.hazelcast.config.CredentialsFactoryConfig in project hazelcast by hazelcast.
the class ClientConfigXmlGeneratorTest method credentialsFactory.
@Test
public void credentialsFactory() {
Properties props = new Properties();
props.setProperty("foo", "bar");
CredentialsFactoryConfig identityConfig = new CredentialsFactoryConfig("com.test.CFactory");
clientConfig.getSecurityConfig().setCredentialsFactoryConfig(identityConfig);
ClientConfig actual = newConfigViaGenerator();
assertEquals(identityConfig, actual.getSecurityConfig().getCredentialsFactoryConfig());
}
Aggregations