@BeforeClass public static void setupBeforeClass() throws Exception { TEST_UTIL = new HBaseTestingUtility(); Configuration conf = TEST_UTIL.getConfiguration(); conf.set(HBaseRPC.RPC_ENGINE_PROP, SecureRpcEngine.class.getName()); conf.set("hbase.coprocessor.region.classes", IdentityCoprocessor.class.getName()); TEST_UTIL.startMiniCluster(); HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0); RpcServer server = rs.getRpcServer(); assertTrue(server instanceof SecureServer); SecretManager mgr = ((SecureServer)server).getSecretManager(); assertTrue(mgr instanceof AuthenticationTokenSecretManager); secretManager = (AuthenticationTokenSecretManager)mgr; }
public static void enableSecurity(Configuration conf) throws IOException { conf.set("hadoop.security.authorization", "false"); conf.set("hadoop.security.authentication", "simple"); conf.set("hbase.rpc.engine", SecureRpcEngine.class.getName()); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, AccessController.class.getName()); conf.set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, AccessController.class.getName()+ ","+SecureBulkLoadEndpoint.class.getName()); conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, AccessController.class.getName()); // add the process running user to superusers String currentUser = User.getCurrent().getName(); conf.set("hbase.superuser", "admin,"+currentUser); }