@InterfaceAudience.Public public class AccessControlClient extends Object
Modifier and Type | Field and Description |
---|---|
static TableName |
ACL_TABLE_NAME |
Constructor and Description |
---|
AccessControlClient() |
Modifier and Type | Method and Description |
---|---|
private static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface |
getAccessControlServiceStub(Table ht) |
static List<UserPermission> |
getUserPermissions(Connection connection,
String tableRegex)
List all the userPermissions matching the given pattern.
|
static List<UserPermission> |
getUserPermissions(Connection connection,
String tableRegex,
byte[] columnFamily)
List all the userPermissions matching the given table pattern and column family.
|
static List<UserPermission> |
getUserPermissions(Connection connection,
String tableRegex,
byte[] columnFamily,
byte[] columnQualifier)
List all the userPermissions matching the given table pattern, column family and column
qualifier.
|
static List<UserPermission> |
getUserPermissions(Connection connection,
String tableRegex,
byte[] columnFamily,
byte[] columnQualifier,
String userName)
List all the userPermissions matching the given table pattern, column family and column
qualifier.
|
static List<UserPermission> |
getUserPermissions(Connection connection,
String tableRegex,
byte[] columnFamily,
String userName)
List all the userPermissions matching the given table pattern, column family and user name.
|
static List<UserPermission> |
getUserPermissions(Connection connection,
String tableRegex,
String userName)
List all the userPermissions matching the given table pattern and user name.
|
private static void |
grant(Connection connection,
String userName,
boolean mergeExistingPermissions,
Permission.Action... actions)
Grant global permissions for the specified user.
|
static void |
grant(Connection connection,
String userName,
Permission.Action... actions)
Grant global permissions for the specified user.
|
private static void |
grant(Connection connection,
String namespace,
String userName,
boolean mergeExistingPermissions,
Permission.Action... actions)
Grants permission on the specified namespace for the specified user.
|
static void |
grant(Connection connection,
String namespace,
String userName,
Permission.Action... actions)
Grants permission on the specified namespace for the specified user.
|
private static void |
grant(Connection connection,
TableName tableName,
String userName,
byte[] family,
byte[] qual,
boolean mergeExistingPermissions,
Permission.Action... actions)
Grants permission on the specified table for the specified user
|
static void |
grant(Connection connection,
TableName tableName,
String userName,
byte[] family,
byte[] qual,
Permission.Action... actions)
Grants permission on the specified table for the specified user.
|
static boolean |
hasPermission(Connection connection,
String tableName,
byte[] columnFamily,
byte[] columnQualifier,
String userName,
Permission.Action... actions)
Validates whether specified user has permission to perform actions on the mentioned table,
column family or column qualifier.
|
static boolean |
hasPermission(Connection connection,
String tableName,
String columnFamily,
String columnQualifier,
String userName,
Permission.Action... actions)
Validates whether specified user has permission to perform actions on the mentioned table,
column family or column qualifier.
|
static boolean |
isAccessControllerRunning(Connection connection) |
static boolean |
isAuthorizationEnabled(Connection connection)
Return true if authorization is supported and enabled
|
static boolean |
isCellAuthorizationEnabled(Connection connection)
Return true if cell authorization is supported and enabled
|
static void |
revoke(Connection connection,
String userName,
Permission.Action... actions)
Revoke global permissions for the specified user.
|
static void |
revoke(Connection connection,
String namespace,
String userName,
Permission.Action... actions)
Revokes the permission on the namespace for the specified user.
|
static void |
revoke(Connection connection,
TableName tableName,
String username,
byte[] family,
byte[] qualifier,
Permission.Action... actions)
Revokes the permission on the table
|
public static final TableName ACL_TABLE_NAME
public AccessControlClient()
public static boolean isAuthorizationEnabled(Connection connection) throws IOException
connection
- The connection to useIOException
public static boolean isCellAuthorizationEnabled(Connection connection) throws IOException
connection
- The connection to useIOException
private static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface getAccessControlServiceStub(Table ht) throws IOException
IOException
private static void grant(Connection connection, TableName tableName, String userName, byte[] family, byte[] qual, boolean mergeExistingPermissions, Permission.Action... actions) throws Throwable
connection
- The Connection instance to usetableName
- userName
- family
- qual
- mergeExistingPermissions
- If set to false, later granted permissions will override
previous granted permissions. otherwise, it'll merge with previous granted
permissions.actions
- Throwable
public static void grant(Connection connection, TableName tableName, String userName, byte[] family, byte[] qual, Permission.Action... actions) throws Throwable
connection
- The Connection instance to usetableName
- userName
- family
- qual
- actions
- Throwable
private static void grant(Connection connection, String namespace, String userName, boolean mergeExistingPermissions, Permission.Action... actions) throws Throwable
connection
- namespace
- userName
- mergeExistingPermissions
- If set to false, later granted permissions will override
previous granted permissions. otherwise, it'll merge with previous granted
permissions.actions
- Throwable
public static void grant(Connection connection, String namespace, String userName, Permission.Action... actions) throws Throwable
connection
- The Connection instance to usenamespace
- userName
- actions
- Throwable
private static void grant(Connection connection, String userName, boolean mergeExistingPermissions, Permission.Action... actions) throws Throwable
connection
- userName
- mergeExistingPermissions
- If set to false, later granted permissions will override
previous granted permissions. otherwise, it'll merge with previous granted
permissions.actions
- Throwable
public static void grant(Connection connection, String userName, Permission.Action... actions) throws Throwable
connection
- userName
- actions
- Throwable
public static boolean isAccessControllerRunning(Connection connection) throws MasterNotRunningException, ZooKeeperConnectionException, IOException
public static void revoke(Connection connection, TableName tableName, String username, byte[] family, byte[] qualifier, Permission.Action... actions) throws Throwable
connection
- The Connection instance to usetableName
- username
- family
- qualifier
- actions
- Throwable
public static void revoke(Connection connection, String namespace, String userName, Permission.Action... actions) throws Throwable
connection
- The Connection instance to usenamespace
- userName
- actions
- Throwable
public static void revoke(Connection connection, String userName, Permission.Action... actions) throws Throwable
connection
- The Connection instance to useThrowable
public static List<UserPermission> getUserPermissions(Connection connection, String tableRegex) throws Throwable
connection
- The Connection instance to usetableRegex
- The regular expression string to match againstThrowable
public static List<UserPermission> getUserPermissions(Connection connection, String tableRegex, String userName) throws Throwable
connection
- ConnectiontableRegex
- The regular expression string to match againstuserName
- User name, if empty then all user permissions will be retrieved.Throwable
- on failurepublic static List<UserPermission> getUserPermissions(Connection connection, String tableRegex, byte[] columnFamily) throws Throwable
connection
- ConnectiontableRegex
- The regular expression string to match against. It shouldn't be null, empty
or a namespace regular expression.columnFamily
- Column familyThrowable
- on failurepublic static List<UserPermission> getUserPermissions(Connection connection, String tableRegex, byte[] columnFamily, String userName) throws Throwable
connection
- ConnectiontableRegex
- The regular expression string to match against. It shouldn't be null, empty
or a namespace regular expression.columnFamily
- Column familyuserName
- User name, if empty then all user permissions will be retrieved.Throwable
- on failurepublic static List<UserPermission> getUserPermissions(Connection connection, String tableRegex, byte[] columnFamily, byte[] columnQualifier) throws Throwable
connection
- ConnectiontableRegex
- The regular expression string to match against. It shouldn't be null, empty
or a namespace regular expression.columnFamily
- Column familycolumnQualifier
- Column qualifierThrowable
- on failurepublic static List<UserPermission> getUserPermissions(Connection connection, String tableRegex, byte[] columnFamily, byte[] columnQualifier, String userName) throws Throwable
connection
- ConnectiontableRegex
- The regular expression string to match against. It shouldn't be null, empty
or a namespace regular expression.columnFamily
- Column familycolumnQualifier
- Column qualifieruserName
- User name, if empty then all user permissions will be retrieved.Throwable
- on failurepublic static boolean hasPermission(Connection connection, String tableName, String columnFamily, String columnQualifier, String userName, Permission.Action... actions) throws Throwable
connection
- ConnectiontableName
- Table name, it shouldn't be null or empty.columnFamily
- The column family. Optional argument, can be empty. If empty then
validation will happen at table level.columnQualifier
- The column qualifier. Optional argument, can be empty. If empty then
validation will happen at table and column family level. columnQualifier will not be
considered if columnFamily is passed as null or empty.userName
- User name, it shouldn't be null or empty.actions
- ActionsThrowable
- on failurepublic static boolean hasPermission(Connection connection, String tableName, byte[] columnFamily, byte[] columnQualifier, String userName, Permission.Action... actions) throws Throwable
connection
- ConnectiontableName
- Table name, it shouldn't be null or empty.columnFamily
- The column family. Optional argument, can be empty. If empty then
validation will happen at table level.columnQualifier
- The column qualifier. Optional argument, can be empty. If empty then
validation will happen at table and column family level. columnQualifier will not be
considered if columnFamily is passed as null or empty.userName
- User name, it shouldn't be null or empty.actions
- ActionsThrowable
- on failureCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.