@Beta public interface Authorizer extends PrivilegesFetcher, PrivilegesManager, AuthorizationEnforcer
principals' authorization for actions on
CDAP entities. Authorization extensions must implement this interface to delegate authorization
to appropriate authorization back-ends. The contract with Authorization extensions is as below:
security.authorization.enabled to true in
cdap-site.xml.security.authorization.extension.jar.path in cdap-site.xmlAuthorizer. This class must be
specified as the Attributes.Name#MAIN_CLASS in the extension jar's manifest file.Authorizer is that it must have a default
constructor.Authorizer also provides lifecycle methods for extensions. initialize(AuthorizationContext)
can be used to perform initialization tasks. This method provides an AuthorizationContext which gives
extensions access to CDAP entities for operations like creating and accessing datasets, accessing datasets in
transactions, etc. It also provides access to extension properties via the
AuthorizationContext.getExtensionProperties() method. The Properties object returned form this
method is populated with all configuration settings from cdap-site.xml that have
keys with the prefix security.authorization.extension.config.destroy() method can be used to perform cleanup tasks.| Modifier and Type | Method and Description |
|---|---|
void |
addRoleToPrincipal(Role role,
Principal principal)
Add a role to the specified
Principal. |
void |
createRole(Role role)
Create a role.
|
void |
destroy()
Destroys an
Authorizer. |
void |
dropRole(Role role)
Drop a role.
|
void |
initialize(AuthorizationContext context)
Initialize the
Authorizer. |
Set<Role> |
listAllRoles()
Returns all available
Role. |
Set<Role> |
listRoles(Principal principal)
|
void |
removeRoleFromPrincipal(Role role,
Principal principal)
Delete a role from the specified
Principal. |
listPrivilegesgrant, revoke, revokecreateFilter, enforce, enforcevoid initialize(AuthorizationContext context) throws Exception
Authorizer. Authorization extensions can use this method to access an
AuthorizationContext that allows them to interact with CDAP for operations such as creating and accessing
datasets, executing dataset operations in transactions, etc.context - the AuthorizationContext that can be used to interact with CDAPExceptionvoid createRole(Role role) throws Exception
role - the Role to createRoleAlreadyExistsException - if the the role to be created already existsExceptionvoid dropRole(Role role) throws Exception
role - the Role to dropRoleNotFoundException - if the role to be dropped is not foundExceptionvoid addRoleToPrincipal(Role role, Principal principal) throws Exception
Principal.role - the Role to add to the specified groupprincipal - the Principal to add the role toRoleNotFoundException - if the role to be added to the principals is not foundExceptionvoid removeRoleFromPrincipal(Role role, Principal principal) throws Exception
Principal.role - the Role to remove from the specified groupprincipal - the Principal to remove the role fromRoleNotFoundException - if the role to be removed to the principals is not foundExceptionSet<Role> listAllRoles() throws Exception
Role. Only a super user can perform this operation.void destroy()
throws Exception
Authorizer. Authorization extensions can use this method to write any cleanup code.ExceptionCopyright © 2017 Cask Data, Inc. Licensed under the Apache License, Version 2.0.