public class CassandraAuthorizer extends java.lang.Object implements IAuthorizer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
USER_PERMISSIONS |
static java.lang.String |
USERNAME |
Constructor and Description |
---|
CassandraAuthorizer() |
Modifier and Type | Method and Description |
---|---|
java.util.Set<Permission> |
authorize(AuthenticatedUser user,
IResource resource)
Returns a set of permissions of a user on a resource.
|
void |
grant(AuthenticatedUser performer,
java.util.Set<Permission> permissions,
IResource resource,
RoleResource grantee)
Grants a set of permissions on a resource to a role.
|
java.util.Set<PermissionDetails> |
list(AuthenticatedUser performer,
java.util.Set<Permission> permissions,
IResource resource,
RoleResource grantee)
Returns a list of permissions on a resource granted to a role.
|
java.util.Set<DataResource> |
protectedResources()
Set of resources that should be made inaccessible to users and only accessible internally.
|
void |
revoke(AuthenticatedUser performer,
java.util.Set<Permission> permissions,
IResource resource,
RoleResource revokee)
Revokes a set of permissions on a resource from a user.
|
void |
revokeAllFrom(RoleResource revokee)
Called before deleting a role with DROP ROLE statement (or the alias provided for compatibility,
DROP USER) so that a new role with the same name wouldn't inherit permissions of the deleted one in the future.
|
void |
revokeAllOn(IResource droppedResource)
This method is called after a resource is removed (i.e.
|
void |
setup()
Setup is called once upon system startup to initialize the IAuthorizer.
|
void |
validateConfiguration()
Validates configuration of IAuthorizer implementation (if configurable).
|
public static final java.lang.String USERNAME
public static final java.lang.String USER_PERMISSIONS
public java.util.Set<Permission> authorize(AuthenticatedUser user, IResource resource)
IAuthorizer
authorize
in interface IAuthorizer
user
- Authenticated user requesting authorization.resource
- Resource for which the authorization is being requested. @see DataResource.public void grant(AuthenticatedUser performer, java.util.Set<Permission> permissions, IResource resource, RoleResource grantee) throws RequestValidationException, RequestExecutionException
IAuthorizer
grant
in interface IAuthorizer
performer
- User who grants the permissions.permissions
- Set of permissions to grant.resource
- Resource on which to grant the permissions.grantee
- Role to which the permissions are to be granted.RequestValidationException
RequestExecutionException
public void revoke(AuthenticatedUser performer, java.util.Set<Permission> permissions, IResource resource, RoleResource revokee) throws RequestValidationException, RequestExecutionException
IAuthorizer
revoke
in interface IAuthorizer
performer
- User who revokes the permissions.permissions
- Set of permissions to revoke.resource
- Resource on which to revoke the permissions.revokee
- Role from which to the permissions are to be revoked.RequestValidationException
RequestExecutionException
public void revokeAllFrom(RoleResource revokee)
IAuthorizer
revokeAllFrom
in interface IAuthorizer
revokee
- The role to revoke all permissions from.public void revokeAllOn(IResource droppedResource)
IAuthorizer
revokeAllOn
in interface IAuthorizer
droppedResource
- The resource to revoke all permissions on.public java.util.Set<PermissionDetails> list(AuthenticatedUser performer, java.util.Set<Permission> permissions, IResource resource, RoleResource grantee) throws RequestValidationException, RequestExecutionException
IAuthorizer
list
in interface IAuthorizer
performer
- User who wants to see the permissions.permissions
- Set of Permission values the user is interested in. The result should only include the
matching ones.resource
- The resource on which permissions are requested. Can be null, in which case permissions on all
resources should be returned.grantee
- The role whose permissions are requested. Can be null, in which case permissions of every
role should be returned.RequestValidationException
RequestExecutionException
public java.util.Set<DataResource> protectedResources()
IAuthorizer
protectedResources
in interface IAuthorizer
public void validateConfiguration() throws ConfigurationException
IAuthorizer
validateConfiguration
in interface IAuthorizer
ConfigurationException
- when there is a configuration error.public void setup()
IAuthorizer
setup
in interface IAuthorizer
Copyright © 2016 The Apache Software Foundation