} catch (Exception e) {
this.getLogger().log(Level.SEVERE,
"The simple account password failed to decrypt.", e);
}
}
UsernamePasswordCredentials creds = new UsernamePasswordCredentials( sUser, sPwd);
creds.setDistinguishedName(sDN);
idConfig.setCatalogAdminDN(creds.getDistinguishedName());
idConfig.getSimpleConfiguration().setServiceAccountCredentials(creds);
}
// roles
Node ndRoles = (Node) xpath.evaluate("roles", ndSimple, XPathConstants.NODE);
if (ndRoles != null) {
Roles roles = idConfig.getConfiguredRoles();
NodeList nlRoles = (NodeList) xpath.evaluate("role", ndRoles, XPathConstants.NODESET);
for (int i = 0; i < nlRoles.getLength(); i++) {
Node ndRole = nlRoles.item(i);
Role role = new Role();
role.setKey(xpath.evaluate("@key", ndRole));
roles.add(role);
}
for (Role role : roles.values()) {
role.buildFullRoleSet(roles);
}
}
}
// LDAP adapter configuration
if (ndLdap != null) {
// connection properties & service account
Node ndCon = (Node) xpath.evaluate("ldapConnectionProperties", ndLdap,
XPathConstants.NODE);
if (ndCon != null) {
LdapConnectionProperties props = ldapConfig.getConnectionProperties();
props.setProviderUrl(xpath.evaluate("@providerURL", ndCon));
props.setInitialContextFactoryName(xpath.evaluate(
"@initialContextFactoryName", ndCon));
props.setSecurityAuthenticationLevel(xpath.evaluate(
"@securityAuthentication", ndCon));
props.setSecurityProtocol(xpath.evaluate("@securityProtocol", ndCon));
Node ndService = (Node) xpath.evaluate("ldapServiceAccount", ndCon, XPathConstants.NODE);
if (ndService != null) {
String sUser = xpath.evaluate("@securityPrincipal", ndService);
String sPwd = xpath.evaluate("@securityCredentials", ndService);
boolean bEncrypted = Val.chkBool(xpath.evaluate("@encrypted", ndService), false);
if (bEncrypted) {
try {
String sDecrypted = PC1_Encryptor.decrypt(sPwd);
sPwd = sDecrypted;
} catch (Exception e) {
this.getLogger().log(Level.SEVERE, "The securityCredentials failed to decrypt.", e);
}
}
UsernamePasswordCredentials creds = new UsernamePasswordCredentials(sUser, sPwd);
props.setServiceAccountCredentials(creds);
idConfig.setCatalogAdminDN(xpath.evaluate("@catalogAdminDN", ndService));
}
}