Search in sources :

Example 1 with StringField

use of org.codice.ddf.admin.common.fields.base.scalar.StringField in project admin-console-beta by connexta.

the class SaveContextPolices method checkClaimsValidity.

private void checkClaimsValidity() {
    List<String> supportedClaims = stsServiceProps.getConfiguredStsClaims(configuratorFactory);
    List<StringField> claimArgs = new ArrayList<>();
    for (ContextPolicyBin bin : contextPolicies.getList()) {
        claimArgs.addAll(bin.claimsMappingField().getList().stream().map(entry -> entry.claimField()).collect(Collectors.toList()));
    }
    claimArgs.stream().filter(claimArg -> !supportedClaims.contains(claimArg.getValue())).forEach(claimArg -> addArgumentMessage(invalidClaimType(claimArg.path())));
}
Also used : POLICY_MANAGER_PID(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties.POLICY_MANAGER_PID) BaseFunctionField(org.codice.ddf.admin.common.fields.base.BaseFunctionField) SecurityMessages.invalidClaimType(org.codice.ddf.admin.security.common.SecurityMessages.invalidClaimType) Collection(java.util.Collection) StringField(org.codice.ddf.admin.common.fields.base.scalar.StringField) StsServiceProperties(org.codice.ddf.admin.security.common.services.StsServiceProperties) PolicyManagerServiceProperties(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties) Configurator(org.codice.ddf.admin.configurator.Configurator) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) ListFieldImpl(org.codice.ddf.admin.common.fields.base.ListFieldImpl) List(java.util.List) DefaultMessages.failedPersistError(org.codice.ddf.admin.common.report.message.DefaultMessages.failedPersistError) OperationReport(org.codice.ddf.admin.configurator.OperationReport) ImmutableList(com.google.common.collect.ImmutableList) ROOT_CONTEXT_PATH(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties.ROOT_CONTEXT_PATH) ListField(org.codice.ddf.admin.api.fields.ListField) ContextPolicyBin(org.codice.ddf.admin.security.common.fields.wcpm.ContextPolicyBin) FunctionField(org.codice.ddf.admin.api.fields.FunctionField) ConfiguratorFactory(org.codice.ddf.admin.configurator.ConfiguratorFactory) SecurityMessages.noRootContextError(org.codice.ddf.admin.security.common.SecurityMessages.noRootContextError) DataType(org.codice.ddf.admin.api.DataType) StringField(org.codice.ddf.admin.common.fields.base.scalar.StringField) ArrayList(java.util.ArrayList) ContextPolicyBin(org.codice.ddf.admin.security.common.fields.wcpm.ContextPolicyBin)

Example 2 with StringField

use of org.codice.ddf.admin.common.fields.base.scalar.StringField in project admin-console-beta by connexta.

the class SourceValidationUtils method validateSourceName.

/**
     * Validates the {@code sourceName} against the existing source names in the system. An empty {@link ReportImpl} will be returned
     * if there are no existing source names with with name {@code sourceName}, or a {@link ReportImpl} with error messages.
     *
     * @param sourceName          source name to validate
     * @param configuratorFactory configurator factory for reading FederatedSource service references
     * @return a {@link ReportImpl} containing a {@link org.codice.ddf.admin.sources.commons.SourceMessages#DUPLICATE_SOURCE_NAME} error, or a Report with
     * no messages on success.
     */
public static ReportImpl validateSourceName(StringField sourceName, ConfiguratorFactory configuratorFactory) {
    List<Source> sources = getAllSourceReferences(configuratorFactory);
    boolean matchFound = sources.stream().map(source -> source.getId()).anyMatch(id -> id.equals(sourceName.getValue()));
    ReportImpl report = new ReportImpl();
    if (matchFound) {
        report.addArgumentMessage(duplicateSourceNameError(sourceName.path()));
    }
    return report;
}
Also used : Source(ddf.catalog.source.Source) List(java.util.List) StringField(org.codice.ddf.admin.common.fields.base.scalar.StringField) SourceUtilCommons.getAllSourceReferences(org.codice.ddf.admin.sources.commons.utils.SourceUtilCommons.getAllSourceReferences) ConfiguredService(ddf.catalog.service.ConfiguredService) ReportImpl(org.codice.ddf.admin.common.report.ReportImpl) ConfiguratorFactory(org.codice.ddf.admin.configurator.ConfiguratorFactory) SourceMessages.duplicateSourceNameError(org.codice.ddf.admin.sources.commons.SourceMessages.duplicateSourceNameError) Source(ddf.catalog.source.Source) ReportImpl(org.codice.ddf.admin.common.report.ReportImpl)

Example 3 with StringField

use of org.codice.ddf.admin.common.fields.base.scalar.StringField in project admin-console-beta by connexta.

the class SecurityValidation method validateStsClaimsExist.

public static Report validateStsClaimsExist(List<StringField> claimArgs, ServiceActions serviceActions, StsServiceProperties stsServiceProps) {
    Report report = Reports.emptyReport();
    List<String> supportedClaims = stsServiceProps.getConfiguredStsClaims(serviceActions);
    claimArgs.stream().filter(claimArg -> !supportedClaims.contains(claimArg.getValue())).forEach(claimArg -> report.addErrorMessage(invalidClaimType(claimArg.getPath())));
    return report;
}
Also used : List(java.util.List) Reports(org.codice.ddf.admin.common.report.Reports) SecurityMessages.invalidClaimType(org.codice.ddf.admin.security.common.SecurityMessages.invalidClaimType) ServiceActions(org.codice.ddf.internal.admin.configurator.actions.ServiceActions) Report(org.codice.ddf.admin.api.report.Report) StringField(org.codice.ddf.admin.common.fields.base.scalar.StringField) StsServiceProperties(org.codice.ddf.admin.security.common.services.StsServiceProperties) Report(org.codice.ddf.admin.api.report.Report)

Example 4 with StringField

use of org.codice.ddf.admin.common.fields.base.scalar.StringField in project admin-console-beta by connexta.

the class FeatureField method addFeatureDeps.

public FeatureField addFeatureDeps(List<String> featsToAdd) {
    for (String featId : featsToAdd) {
        StringField newStr = new StringField();
        newStr.setValue(featId);
        featDeps.add(newStr);
    }
    return this;
}
Also used : StringField(org.codice.ddf.admin.common.fields.base.scalar.StringField)

Example 5 with StringField

use of org.codice.ddf.admin.common.fields.base.scalar.StringField in project admin-console-beta by connexta.

the class SaveContextPolices method validate.

@Override
public void validate() {
    super.validate();
    checkForTrailingSlashes();
    checkRootPathExists();
    if (containsErrorMsgs()) {
        return;
    }
    List<StringField> claimArgs = new ArrayList<>();
    for (ContextPolicyBin bin : contextPolicies.getList()) {
        claimArgs.addAll(bin.claimsMappingField().getList().stream().map(ClaimsMapEntry::claimField).collect(Collectors.toList()));
    }
    addErrorMessages(SecurityValidation.validateStsClaimsExist(claimArgs, configuratorSuite.getServiceActions(), stsServiceProps));
}
Also used : ClaimsMapEntry(org.codice.ddf.admin.security.common.fields.wcpm.ClaimsMapEntry) StringField(org.codice.ddf.admin.common.fields.base.scalar.StringField) ArrayList(java.util.ArrayList) ContextPolicyBin(org.codice.ddf.admin.security.common.fields.wcpm.ContextPolicyBin)

Aggregations

StringField (org.codice.ddf.admin.common.fields.base.scalar.StringField)5 List (java.util.List)3 ArrayList (java.util.ArrayList)2 ConfiguratorFactory (org.codice.ddf.admin.configurator.ConfiguratorFactory)2 SecurityMessages.invalidClaimType (org.codice.ddf.admin.security.common.SecurityMessages.invalidClaimType)2 ContextPolicyBin (org.codice.ddf.admin.security.common.fields.wcpm.ContextPolicyBin)2 StsServiceProperties (org.codice.ddf.admin.security.common.services.StsServiceProperties)2 ImmutableList (com.google.common.collect.ImmutableList)1 ConfiguredService (ddf.catalog.service.ConfiguredService)1 Source (ddf.catalog.source.Source)1 Collection (java.util.Collection)1 Collectors (java.util.stream.Collectors)1 DataType (org.codice.ddf.admin.api.DataType)1 FunctionField (org.codice.ddf.admin.api.fields.FunctionField)1 ListField (org.codice.ddf.admin.api.fields.ListField)1 Report (org.codice.ddf.admin.api.report.Report)1 BaseFunctionField (org.codice.ddf.admin.common.fields.base.BaseFunctionField)1 ListFieldImpl (org.codice.ddf.admin.common.fields.base.ListFieldImpl)1 ReportImpl (org.codice.ddf.admin.common.report.ReportImpl)1 Reports (org.codice.ddf.admin.common.report.Reports)1