use of ddf.security.permission.impl.KeyValueCollectionPermissionImpl in project ddf by codice.
the class DefaultContextAttributeMappingTest method setup.
@Before
public void setup() {
List<KeyValuePermission> userPerms = new ArrayList<KeyValuePermission>();
userPerms.add(new KeyValuePermissionImpl("role", Arrays.asList("admin")));
userPerms.add(new KeyValuePermissionImpl("controls", Arrays.asList("Foo", "Bar")));
userPerms.add(new KeyValuePermissionImpl("control", Arrays.asList("Foo")));
userPermissions = new KeyValueCollectionPermissionImpl("context", userPerms);
roleMapping = new DefaultContextAttributeMapping("context", "role", "admin");
roleMapping2 = new DefaultContextAttributeMapping("context", "role", "charlie");
controlsMapping = new DefaultContextAttributeMapping("context", "controls", "Foo");
controlMapping = new DefaultContextAttributeMapping("context", "control", "Bar");
}
use of ddf.security.permission.impl.KeyValueCollectionPermissionImpl in project ddf by codice.
the class AuthzRealm method isPermittedByExtensionAll.
private KeyValueCollectionPermission isPermittedByExtensionAll(CollectionPermission subjectAllCollection, KeyValueCollectionPermission matchAllCollection, KeyValueCollectionPermission allPermissionsCollection) {
if (!CollectionUtils.isEmpty(policyExtensions)) {
KeyValueCollectionPermission resultCollection = new KeyValueCollectionPermissionImpl();
resultCollection.addAll(matchAllCollection.getPermissionList());
resultCollection.setAction(matchAllCollection.getAction());
for (PolicyExtension policyExtension : policyExtensions) {
try {
resultCollection = policyExtension.isPermittedMatchAll(subjectAllCollection, resultCollection, allPermissionsCollection);
} catch (Exception e) {
securityLogger.auditWarn(POLICY_EXTENSION_WARNING_MSG, e);
LOGGER.warn(POLICY_EXTENSION_WARNING_MSG, e);
}
}
return resultCollection;
}
return matchAllCollection;
}
Aggregations