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())));
}
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;
}
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;
}
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;
}
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));
}
Aggregations