Search in sources :

Example 1 with Authorizable

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;
}
Also used : InheritingAuthorizable(org.apache.nifi.registry.security.authorization.resource.InheritingAuthorizable) Authorizable(org.apache.nifi.registry.security.authorization.resource.Authorizable)

Example 2 with 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);
}
Also used : Authorizable(org.apache.nifi.registry.security.authorization.resource.Authorizable)

Example 3 with Authorizable

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);
}
Also used : Authorizable(org.apache.nifi.registry.security.authorization.resource.Authorizable)

Example 4 with Authorizable

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);
}
Also used : Authorizable(org.apache.nifi.registry.security.authorization.resource.Authorizable)

Example 5 with Authorizable

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);
}
Also used : Authorizable(org.apache.nifi.registry.security.authorization.resource.Authorizable)

Aggregations

Authorizable (org.apache.nifi.registry.security.authorization.resource.Authorizable)7 Permissions (org.apache.nifi.registry.authorization.Permissions)1 InheritingAuthorizable (org.apache.nifi.registry.security.authorization.resource.InheritingAuthorizable)1