use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class InstallEmbeddedLdap method performFunction.
@Override
@SuppressWarnings("squid:SwitchLastCaseIsDefaultCheck")
public BooleanField performFunction() {
Configurator configurator = configuratorFactory.getConfigurator();
configurator.add(featureActions.start(EMBEDDED_LDAP_FEATURE));
switch(useCase.getValue()) {
case AUTHENTICATION:
configurator.add(featureActions.start(LDAP_LOGIN_FEATURE));
configurator.add(featureActions.start(DEFAULT_EMBEDDED_LDAP_LOGIN_CONFIG_FEATURE));
break;
case ATTRIBUTE_STORE:
configurator.add(featureActions.start(LDAP_CLAIMS_HANDLER_FEATURE));
configurator.add(featureActions.start(DEFAULT_EMBEDDED_LDAP_CLAIMS_HANDLER_CONFIG_FEATURE));
break;
case AUTHENTICATION_AND_ATTRIBUTE_STORE:
configurator.add(featureActions.start(LDAP_LOGIN_FEATURE));
configurator.add(featureActions.start(LDAP_CLAIMS_HANDLER_FEATURE));
configurator.add(featureActions.start(ALL_DEFAULT_EMBEDDED_LDAP_CONFIG_FEATURE));
break;
}
OperationReport report = configurator.commit("Installed Embedded LDAP");
if (report.containsFailedResults()) {
addErrorMessage(failedPersistError());
}
return new BooleanField(!containsErrorMsgs());
}
use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class CreateLdapConfiguration method performFunction.
@Override
public BooleanField performFunction() {
Configurator configurator = configuratorSuite.getConfiguratorFactory().getConfigurator();
String authType = config.settingsField().useCase();
if (authType.equalsIgnoreCase(AUTHENTICATION) || authType.equalsIgnoreCase(AUTHENTICATION_AND_ATTRIBUTE_STORE)) {
Map<String, Object> ldapLoginServiceProps = ldapServiceCommons.ldapConfigurationToLdapLoginService(config);
configurator.add(configuratorSuite.getFeatureActions().start(LdapLoginServiceProperties.LDAP_LOGIN_FEATURE));
configurator.add(configuratorSuite.getManagedServiceActions().create(LdapLoginServiceProperties.LDAP_LOGIN_MANAGED_SERVICE_FACTORY_PID, ldapLoginServiceProps));
}
if (authType.equalsIgnoreCase(ATTRIBUTE_STORE) || authType.equalsIgnoreCase(AUTHENTICATION_AND_ATTRIBUTE_STORE)) {
Path newAttributeMappingPath = Paths.get(System.getProperty("ddf.home"), "etc", "ws-security", "ldapAttributeMap-" + UUID.randomUUID().toString() + ".props");
Map<String, Object> ldapClaimsServiceProps = ldapServiceCommons.ldapConfigToLdapClaimsHandlerService(config, newAttributeMappingPath.toString());
configurator.add(configuratorSuite.getPropertyActions().create(newAttributeMappingPath, config.claimsMapping()));
configurator.add(configuratorSuite.getFeatureActions().start(LdapClaimsHandlerServiceProperties.LDAP_CLAIMS_HANDLER_FEATURE));
configurator.add(configuratorSuite.getManagedServiceActions().create(LdapClaimsHandlerServiceProperties.LDAP_CLAIMS_HANDLER_MANAGED_SERVICE_FACTORY_PID, ldapClaimsServiceProps));
}
OperationReport report = AccessController.doPrivileged((PrivilegedAction<OperationReport>) () -> configurator.commit("Creating LDAP configuration."));
if (report.containsFailedResults()) {
addErrorMessage(failedPersistError());
}
return new BooleanField(!containsErrorMsgs());
}
Aggregations