Search in sources :

Example 6 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class DeleteLdapConfiguration method performFunction.

@Override
public ListField<LdapConfigurationField> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.deleteManagedService(pid.getValue());
    OperationReport report = configurator.commit("LDAP Configuration deleted for servicePid: {}", pid.getValue());
    // TODO: tbatie - 4/3/17 - Add error reporting here
    return serviceCommons.getLdapConfigurations(configuratorFactory);
}
Also used : Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 7 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class SaveLdapConfiguration method performFunction.

@Override
public ListField<LdapConfigurationField> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    if (config.settingsField().useCase().equals(LOGIN) || config.settingsField().useCase().equals(LOGIN_AND_ATTRIBUTE_STORE)) {
        Map<String, Object> ldapLoginServiceProps = serviceCommons.ldapConfigurationToLdapLoginService(config);
        configurator.startFeature(LdapLoginServiceProperties.LDAP_LOGIN_FEATURE);
        configurator.createManagedService(LdapLoginServiceProperties.LDAP_LOGIN_MANAGED_SERVICE_FACTORY_PID, ldapLoginServiceProps);
    }
    if (config.settingsField().useCase().equals(ATTRIBUTE_STORE) || config.settingsField().useCase().equals(LOGIN_AND_ATTRIBUTE_STORE)) {
        Path newAttributeMappingPath = Paths.get(System.getProperty("ddf.home"), "etc", "ws-security", "ldapAttributeMap-" + UUID.randomUUID().toString() + ".props");
        Map<String, Object> ldapClaimsServiceProps = serviceCommons.ldapConfigToLdapClaimsHandlerService(config);
        configurator.createPropertyFile(newAttributeMappingPath, config.settingsField().attributeMap());
        configurator.startFeature(LdapClaimsHandlerServiceProperties.LDAP_CLAIMS_HANDLER_FEATURE);
        configurator.createManagedService(LdapClaimsHandlerServiceProperties.LDAP_CLAIMS_HANDLER_MANAGED_SERVICE_FACTORY_PID, ldapClaimsServiceProps);
    }
    OperationReport report = configurator.commit("LDAP Configuration saved with details: {}", config.toString());
    // TODO: tbatie - 4/3/17 - Handle error messages
    return serviceCommons.getLdapConfigurations(configuratorFactory);
}
Also used : Path(java.nio.file.Path) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 8 with Configurator

use of org.codice.ddf.admin.configurator.Configurator in project admin-console-beta by connexta.

the class ServiceCommons method updateService.

public static ReportImpl updateService(PidField servicePid, Map<String, Object> newConfig, ConfiguratorFactory configuratorFactory) {
    ReportImpl report = new ReportImpl();
    report.addMessages(serviceConfigurationExists(servicePid, configuratorFactory));
    if (report.containsErrorMsgs()) {
        return report;
    }
    String pid = servicePid.getValue();
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.updateConfigFile(pid, newConfig, true);
    OperationReport operationReport = configurator.commit("Updated config with pid [{}] and new service properties [{}]", pid, newConfig.toString());
    if (operationReport.containsFailedResults()) {
        return report.addResultMessage(failedUpdateError());
    }
    return report;
}
Also used : Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport) ReportImpl(org.codice.ddf.admin.common.report.ReportImpl)

Aggregations

Configurator (org.codice.ddf.admin.configurator.Configurator)8 OperationReport (org.codice.ddf.admin.configurator.OperationReport)6 ReportImpl (org.codice.ddf.admin.common.report.ReportImpl)3 PolicyManagerServiceProperties (org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties)2 Path (java.nio.file.Path)1 BooleanField (org.codice.ddf.admin.common.fields.base.scalar.BooleanField)1 ErrorMessage (org.codice.ddf.admin.common.report.message.ErrorMessage)1