Class SecureTestUtil
java.lang.Object
org.apache.hadoop.hbase.security.access.SecureTestUtil
- Direct Known Subclasses:
- SnapshotWithAclTestBase,- TestAccessControlFilter,- TestAccessController,- TestAccessController2,- TestAccessController3,- TestCellACLs,- TestCellACLWithMultipleVersions,- TestCoprocessorWhitelistMasterObserver,- TestNamespaceCommands,- TestRSGroupsWithACL,- TestScanEarlyTermination,- TestUnloadAccessController,- TestWithDisabledAuthorization
Utility methods for testing security
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceAn AccessTestAction performs an action that will be examined to confirm the results conform to expected access rights.static class
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidcheckGlobalPerms(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.access.Permission.Action... actions) private static voidcheckPermissions(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.security.access.Permission... perms) static voidcheckTablePerms(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.access.Permission... perms) static voidcheckTablePerms(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] column, org.apache.hadoop.hbase.security.access.Permission.Action... actions) static voidconfigureSuperuser(org.apache.hadoop.conf.Configuration conf) static StringconvertToNamespace(String namespace) static voidcreateNamespace(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.NamespaceDescriptor nsDesc) static voidcreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.TableDescriptor htd) static voidcreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.TableDescriptor htd, byte[][] splitKeys) static voidcreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.TableDescriptor htd) static voidcreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.TableDescriptor htd, byte[][] splitKeys) static voidcreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.User user, org.apache.hadoop.hbase.client.TableDescriptor htd) static voidcreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.User user, org.apache.hadoop.hbase.client.TableDescriptor htd, byte[][] splitKeys) static org.apache.hadoop.hbase.client.TablecreateTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.TableName tableName, byte[][] families) static voiddeleteNamespace(HBaseTestingUtil testUtil, String namespace) static voiddeleteTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName tableName) static voiddeleteTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.TableName tableName) static voidenableSecurity(org.apache.hadoop.conf.Configuration conf) private static List<org.apache.hadoop.hbase.security.access.AccessController>static voidgrantGlobal(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions globally to the given user.static voidgrantGlobal(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions globally to the given user.static voidgrantGlobalUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant global permissions to the given user using AccessControlClient.static voidgrantOnNamespace(HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions on a namespace to the given user.static voidgrantOnNamespace(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions on a namespace to the given user.static voidgrantOnNamespaceUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions on a namespace to the given user using AccessControl Client.static voidgrantOnTable(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions on a table to the given user.static voidgrantOnTable(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions on a table to the given user.static voidgrantOnTableUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Grant permissions on a table to the given user using AccessControlClient.static voidrevokeFromNamespace(HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions on a namespace from the given user.static voidrevokeFromNamespace(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions on a namespace from the given user.static voidrevokeFromNamespaceUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions on a namespace from the given user using AccessControl Client.static voidrevokeFromTable(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions on a table from the given user.static voidrevokeFromTable(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions on a table from the given user.static voidrevokeFromTableUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions on a table from the given user using AccessControlClient.static voidrevokeGlobal(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions globally from the given user.static voidrevokeGlobal(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke permissions globally from the given user.static voidrevokeGlobalUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) Revoke global permissions from the given user using AccessControlClient.private static voidupdateACLs(HBaseTestingUtil util, Callable c) static voidverifyAllowed(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) This fails only in case of ADE or empty list for any of the users.static voidverifyAllowed(org.apache.hadoop.hbase.security.User user, SecureTestUtil.AccessTestAction... actions) This fails only in case of ADE or empty list for any of the actions.static voidverifyAllowed(org.apache.hadoop.hbase.security.User user, SecureTestUtil.AccessTestAction action, int count) static voidverifyConfiguration(org.apache.hadoop.conf.Configuration conf) static voidverifyDenied(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) This passes only in case of ADE for all users.static voidverifyDenied(org.apache.hadoop.hbase.security.User user, SecureTestUtil.AccessTestAction... actions) This passes only in case of ADE for all actions.static voidverifyIfEmptyList(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) This passes only in case of empty list for all users.static voidverifyIfNull(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) This passes only in case of null for all users.
- 
Field Details- 
LOG
- 
WAIT_TIME- See Also:
 
 
- 
- 
Constructor Details- 
SecureTestUtilpublic SecureTestUtil()
 
- 
- 
Method Details- 
configureSuperuser- Throws:
- IOException
 
- 
enableSecurity- Throws:
- IOException
 
- 
verifyConfiguration
- 
verifyAllowedpublic static void verifyAllowed(org.apache.hadoop.hbase.security.User user, SecureTestUtil.AccessTestAction... actions) throws Exception This fails only in case of ADE or empty list for any of the actions.- Throws:
- Exception
 
- 
verifyAllowedpublic static void verifyAllowed(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) throws Exception This fails only in case of ADE or empty list for any of the users.- Throws:
- Exception
 
- 
verifyAllowedpublic static void verifyAllowed(org.apache.hadoop.hbase.security.User user, SecureTestUtil.AccessTestAction action, int count) throws Exception - Throws:
- Exception
 
- 
verifyDeniedpublic static void verifyDenied(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) throws Exception This passes only in case of ADE for all users.- Throws:
- Exception
 
- 
verifyIfEmptyListpublic static void verifyIfEmptyList(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) throws Exception This passes only in case of empty list for all users.- Throws:
- Exception
 
- 
verifyIfNullpublic static void verifyIfNull(SecureTestUtil.AccessTestAction action, org.apache.hadoop.hbase.security.User... users) throws Exception This passes only in case of null for all users.- Throws:
- Exception
 
- 
verifyDeniedpublic static void verifyDenied(org.apache.hadoop.hbase.security.User user, SecureTestUtil.AccessTestAction... actions) throws Exception This passes only in case of ADE for all actions.- Throws:
- Exception
 
- 
getAccessControllersprivate static List<org.apache.hadoop.hbase.security.access.AccessController> getAccessControllers(SingleProcessHBaseCluster cluster) 
- 
getAuthManagerMTimesprivate static Map<org.apache.hadoop.hbase.security.access.AccessController,Long> getAuthManagerMTimes(SingleProcessHBaseCluster cluster) 
- 
updateACLs- Throws:
- Exception
 
- 
grantGlobalpublic static void grantGlobal(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions globally to the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantGlobalpublic static void grantGlobal(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions globally to the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeGlobalpublic static void revokeGlobal(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions globally from the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeGlobalpublic static void revokeGlobal(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions globally from the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantOnNamespacepublic static void grantOnNamespace(HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions on a namespace to the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantOnNamespacepublic static void grantOnNamespace(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions on a namespace to the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantOnNamespaceUsingAccessControlClientpublic static void grantOnNamespaceUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions on a namespace to the given user using AccessControl Client. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeFromNamespaceUsingAccessControlClientpublic static void revokeFromNamespaceUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions on a namespace from the given user using AccessControl Client. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeFromNamespacepublic static void revokeFromNamespace(HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions on a namespace from the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeFromNamespacepublic static void revokeFromNamespace(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, String namespace, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions on a namespace from the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantOnTablepublic static void grantOnTable(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions on a table to the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantOnTablepublic static void grantOnTable(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions on a table to the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantOnTableUsingAccessControlClientpublic static void grantOnTableUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant permissions on a table to the given user using AccessControlClient. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
grantGlobalUsingAccessControlClientpublic static void grantGlobalUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Grant global permissions to the given user using AccessControlClient. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeFromTablepublic static void revokeFromTable(HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions on a table from the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeFromTablepublic static void revokeFromTable(org.apache.hadoop.hbase.security.User caller, HBaseTestingUtil util, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions on a table from the given user. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeFromTableUsingAccessControlClientpublic static void revokeFromTableUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] qualifier, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke permissions on a table from the given user using AccessControlClient. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
revokeGlobalUsingAccessControlClientpublic static void revokeGlobalUsingAccessControlClient(HBaseTestingUtil util, org.apache.hadoop.hbase.client.Connection connection, String user, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws Exception Revoke global permissions from the given user using AccessControlClient. Will wait until all active AccessController instances have updated their permissions caches or will throw an exception upon timeout (10 seconds).- Throws:
- Exception
 
- 
createTablepublic static org.apache.hadoop.hbase.client.Table createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.TableName tableName, byte[][] families) throws Exception - Throws:
- Exception
 
- 
createTablepublic static void createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.TableDescriptor htd) throws Exception - Throws:
- Exception
 
- 
createTablepublic static void createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.TableDescriptor htd, byte[][] splitKeys) throws Exception - Throws:
- Exception
 
- 
createTablepublic static void createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.TableDescriptor htd) throws Exception - Throws:
- Exception
 
- 
createTablepublic static void createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.TableDescriptor htd, byte[][] splitKeys) throws Exception - Throws:
- Exception
 
- 
createTablepublic static void createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.User user, org.apache.hadoop.hbase.client.TableDescriptor htd) throws Exception - Throws:
- Exception
 
- 
createTablepublic static void createTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.User user, org.apache.hadoop.hbase.client.TableDescriptor htd, byte[][] splitKeys) throws Exception - Throws:
- Exception
 
- 
deleteTablepublic static void deleteTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.TableName tableName) throws Exception - Throws:
- Exception
 
- 
createNamespacepublic static void createNamespace(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.NamespaceDescriptor nsDesc) throws Exception - Throws:
- Exception
 
- 
deleteNamespace- Throws:
- Exception
 
- 
deleteTablepublic static void deleteTable(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName tableName) throws Exception - Throws:
- Exception
 
- 
convertToNamespace
- 
checkGlobalPermspublic static void checkGlobalPerms(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws IOException - Throws:
- IOException
 
- 
checkTablePermspublic static void checkTablePerms(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.TableName table, byte[] family, byte[] column, org.apache.hadoop.hbase.security.access.Permission.Action... actions) throws IOException - Throws:
- IOException
 
- 
checkTablePermspublic static void checkTablePerms(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.security.access.Permission... perms) throws IOException - Throws:
- IOException
 
- 
checkPermissionsprivate static void checkPermissions(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.security.access.Permission... perms) throws IOException - Throws:
- IOException
 
 
-