use of org.apache.nifi.registry.security.authorization.resource.Authorizable in project nifi-registry by apache.
the class StandardAuthorizableLookup method getAuthorizableByChildResource.
private Authorizable getAuthorizableByChildResource(final ResourceType baseResourceType, final String childResourceId) {
Authorizable authorizable;
switch(baseResourceType) {
case Bucket:
String[] childResourcePathParts = childResourceId.split("/");
if (childResourcePathParts.length >= 1) {
final String bucketId = childResourcePathParts[1];
authorizable = getBucketAuthorizable(bucketId);
break;
}
default:
throw new IllegalArgumentException("Unexpected lookup for child resource authorizable for base resource type " + baseResourceType.getValue());
}
return authorizable;
}
use of org.apache.nifi.registry.security.authorization.resource.Authorizable in project nifi-registry by apache.
the class AccessPolicyResource method authorizeAccess.
private void authorizeAccess(RequestAction actionType) {
final Authorizable policiesAuthorizable = authorizableLookup.getPoliciesAuthorizable();
authorizationService.authorize(policiesAuthorizable, actionType);
}
use of org.apache.nifi.registry.security.authorization.resource.Authorizable in project nifi-registry by apache.
the class AuthorizableApplicationResource method authorizeBucketAccess.
protected void authorizeBucketAccess(RequestAction actionType, String bucketIdentifier) {
final Authorizable bucketAuthorizable = authorizableLookup.getBucketAuthorizable(bucketIdentifier);
authorizationService.authorize(bucketAuthorizable, actionType);
}
use of org.apache.nifi.registry.security.authorization.resource.Authorizable in project nifi-registry by apache.
the class ResourceAuthorizationFilter method authorizeAccess.
private void authorizeAccess(String path, RequestAction action) throws AccessDeniedException {
if (path == null || action == null) {
throw new IllegalArgumentException("Authorization is required, but a required input [resource, action] is absent.");
}
Authorizable authorizable = authorizableLookup.getAuthorizableByResource(path);
if (authorizable == null) {
throw new IllegalStateException("Resource Authorization Filter configured for non-authorizable resource: " + path);
}
// throws AccessDeniedException if current user is not authorized to perform requested action on resource
authorizationService.authorize(authorizable, action);
}
use of org.apache.nifi.registry.security.authorization.resource.Authorizable in project nifi-registry by apache.
the class BucketResource method authorizeAccess.
private void authorizeAccess(RequestAction actionType) throws AccessDeniedException {
final Authorizable bucketsAuthorizable = authorizableLookup.getBucketsAuthorizable();
authorizationService.authorize(bucketsAuthorizable, actionType);
}
Aggregations