@InterfaceAudience.Private public final class AccessChecker extends Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
AUDITLOG |
private TableAuthManager |
authManager |
private boolean |
authorizationEnabled
if we are active, usually false, only true if "hbase.security.authorization"
has been set to true in site configuration.see HBASE-19483.
|
Constructor and Description |
---|
AccessChecker(org.apache.hadoop.conf.Configuration conf,
ZKWatcher zkw)
Constructor with existing configuration
|
Modifier and Type | Method and Description |
---|---|
void |
checkLockPermissions(User user,
String namespace,
TableName tableName,
RegionInfo[] regionInfos,
String reason) |
TableAuthManager |
getAuthManager() |
static boolean |
isAuthorizationSupported(org.apache.hadoop.conf.Configuration conf) |
static void |
logResult(AuthResult result) |
void |
requireAccess(User user,
String request,
TableName tableName,
Permission.Action... permissions)
Authorizes that the current user has any of the given permissions to access the table.
|
void |
requireGlobalPermission(User user,
String request,
Permission.Action perm,
String namespace)
Checks that the user has the given global permission.
|
void |
requireGlobalPermission(User user,
String request,
Permission.Action perm,
TableName tableName,
Map<byte[],? extends Collection<byte[]>> familyMap)
Checks that the user has the given global permission.
|
void |
requireNamespacePermission(User user,
String request,
String namespace,
Permission.Action... permissions)
Checks that the user has the given global or namespace permission.
|
void |
requireNamespacePermission(User user,
String request,
String namespace,
TableName tableName,
Map<byte[],? extends Collection<byte[]>> familyMap,
Permission.Action... permissions)
Checks that the user has the given global or namespace permission.
|
void |
requirePermission(User user,
String request,
Permission.Action perm)
Authorizes that the current user has global privileges for the given action.
|
void |
requirePermission(User user,
String request,
TableName tableName,
byte[] family,
byte[] qualifier,
Permission.Action... permissions)
Authorizes that the current user has any of the given permissions for the
given table, column family and column qualifier.
|
void |
requireTablePermission(User user,
String request,
TableName tableName,
byte[] family,
byte[] qualifier,
Permission.Action... permissions)
Authorizes that the current user has any of the given permissions for the
given table, column family and column qualifier.
|
void |
stop()
Releases
TableAuthManager 's reference. |
private static final org.slf4j.Logger AUDITLOG
private TableAuthManager authManager
private boolean authorizationEnabled
public AccessChecker(org.apache.hadoop.conf.Configuration conf, ZKWatcher zkw) throws RuntimeException
conf
- Existing configuration to usezkw
- reference to the ZKWatcher
RuntimeException
public static boolean isAuthorizationSupported(org.apache.hadoop.conf.Configuration conf)
public void stop()
TableAuthManager
's reference.public TableAuthManager getAuthManager()
public void requireAccess(User user, String request, TableName tableName, Permission.Action... permissions) throws IOException
tableName
- Table requestedpermissions
- Actions being requestedIOException
- if obtaining the current user failsAccessDeniedException
- if user has no authorizationpublic void requirePermission(User user, String request, Permission.Action perm) throws IOException
perm
- The action being requestedIOException
- if obtaining the current user failsAccessDeniedException
- if authorization is deniedpublic void requireGlobalPermission(User user, String request, Permission.Action perm, TableName tableName, Map<byte[],? extends Collection<byte[]>> familyMap) throws IOException
perm
- Action being requestedtableName
- Affected table name.familyMap
- Affected column families.IOException
public void requireGlobalPermission(User user, String request, Permission.Action perm, String namespace) throws IOException
perm
- Action being requestednamespace
- The given namespaceIOException
public void requireNamespacePermission(User user, String request, String namespace, Permission.Action... permissions) throws IOException
namespace
- The given namespacepermissions
- Actions being requestedIOException
public void requireNamespacePermission(User user, String request, String namespace, TableName tableName, Map<byte[],? extends Collection<byte[]>> familyMap, Permission.Action... permissions) throws IOException
namespace
- The given namespacepermissions
- Actions being requestedIOException
public void requirePermission(User user, String request, TableName tableName, byte[] family, byte[] qualifier, Permission.Action... permissions) throws IOException
tableName
- Table requestedfamily
- Column family requestedqualifier
- Column qualifier requestedIOException
- if obtaining the current user failsAccessDeniedException
- if user has no authorizationpublic void requireTablePermission(User user, String request, TableName tableName, byte[] family, byte[] qualifier, Permission.Action... permissions) throws IOException
tableName
- Table requestedfamily
- Column family paramqualifier
- Column qualifier paramIOException
- if obtaining the current user failsAccessDeniedException
- if user has no authorizationpublic void checkLockPermissions(User user, String namespace, TableName tableName, RegionInfo[] regionInfos, String reason) throws IOException
IOException
public static void logResult(AuthResult result)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.