use of ddf.security.permission.impl.PermissionsImpl in project ddf by codice.
the class FilterPluginTest method testPluginFilterResourceNoStrategiesGood.
@Test
public void testPluginFilterResourceNoStrategiesGood() throws StopProcessingException {
plugin = new FilterPlugin(new Security());
plugin.setPermissions(new PermissionsImpl());
plugin.processPostResource(resourceResponse, getExactRolesMetacard());
}
use of ddf.security.permission.impl.PermissionsImpl in project ddf by codice.
the class FilterPluginTest method testPluginFilterNoStrategies.
@Test
public void testPluginFilterNoStrategies() {
plugin = new FilterPlugin(new Security());
plugin.setPermissions(new PermissionsImpl());
plugin.setSubjectOperations(new SubjectUtils());
plugin.setSecurityLogger(mock(SecurityLogger.class));
try {
QueryResponse response = plugin.processPostQuery(incomingResponse);
verifyFilterResponse(response);
} catch (StopProcessingException e) {
LOGGER.error("Stopped processing the redaction plugin", e);
}
}
use of ddf.security.permission.impl.PermissionsImpl in project ddf by codice.
the class ResourceUriPolicyTest method getPolicyPlugin.
private ResourceUriPolicy getPolicyPlugin() {
ResourceUriPolicy resourceUriPolicy = new ResourceUriPolicy(new String[] { "role=admin", "fizzle=bang" }, new String[] { "role=admin", "fizzle=bang" });
resourceUriPolicy.setPermissions(new PermissionsImpl());
return resourceUriPolicy;
}
use of ddf.security.permission.impl.PermissionsImpl in project ddf by codice.
the class AdminConfigPolicyTest method testRemoveUnknownAttribute.
@Test
public void testRemoveUnknownAttribute() {
AdminConfigPolicy adminConfigPolicy = new AdminConfigPolicy();
adminConfigPolicy.setPermissions(new PermissionsImpl());
List<KeyValuePermission> matchOneServicePermissions = new ArrayList<>();
matchOneServicePermissions.add(new KeyValuePermissionImpl(AdminConfigPolicy.SERVICE_PID, Sets.newHashSet("UNKNOWN_ATTRIBUTE_NAME")));
KeyValueCollectionPermission requestedServicePermissions = new KeyValueCollectionPermissionImpl(AdminConfigPolicy.VIEW_SERVICE_ACTION, matchOneServicePermissions.stream().toArray(KeyValuePermissionImpl[]::new));
assertTrue(adminConfigPolicy.isPermittedMatchAll(getSubjectPermissions(), requestedServicePermissions, requestedServicePermissions).isEmpty());
}
use of ddf.security.permission.impl.PermissionsImpl in project ddf by codice.
the class AdminConfigPolicyTest method testValidateAllPermissions.
@Test
public void testValidateAllPermissions() {
AdminConfigPolicy adminConfigPolicy = new AdminConfigPolicy();
adminConfigPolicy.setPermissions(new PermissionsImpl());
adminConfigPolicy.setFeaturePolicies(getValidPolicyPermissions());
adminConfigPolicy.setServicePolicies(getValidPolicyPermissions());
KeyValueCollectionPermission requestedFeaturePermissions = new KeyValueCollectionPermissionImpl(AdminConfigPolicy.VIEW_FEATURE_ACTION, getMatchOnePermissions(AdminConfigPolicy.FEATURE_NAME).stream().toArray(KeyValuePermissionImpl[]::new));
KeyValueCollectionPermission requestedServicePermissions = new KeyValueCollectionPermissionImpl(AdminConfigPolicy.VIEW_SERVICE_ACTION, getMatchOnePermissions(AdminConfigPolicy.SERVICE_PID).stream().toArray(KeyValuePermissionImpl[]::new));
assertTrue(adminConfigPolicy.isPermittedMatchOne(getSubjectPermissions(), requestedFeaturePermissions, requestedFeaturePermissions).isEmpty());
assertTrue(adminConfigPolicy.isPermittedMatchOne(getSubjectPermissions(), requestedServicePermissions, requestedServicePermissions).isEmpty());
}
Aggregations