/** * Verify that no exception is thrown if authorization is enabled from hive cli, * when sql std auth is used */ @Test public void testAuthEnable() throws Exception { HiveConf processedConf = new HiveConf(); processedConf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true); HiveAuthorizerFactory authorizerFactory = new SQLStdHiveAuthorizerFactory(); HiveAuthorizer authorizer = authorizerFactory.createHiveAuthorizer(null, processedConf, new HadoopDefaultAuthenticator(), getCLISessionCtx()); }
/** * Test that SQLStdHiveAccessController is not applying config restrictions on CLI * * @throws HiveAuthzPluginException */ @Test public void testConfigProcessing() throws HiveAuthzPluginException { HiveConf processedConf = new HiveConf(); SQLStdHiveAccessController accessController = new SQLStdHiveAccessController(null, processedConf, new HadoopDefaultAuthenticator(), getCLISessionCtx() ); accessController.applyAuthorizationConfigPolicy(processedConf); // check that hook to disable transforms has not been added assertFalse("Check for transform query disabling hook", processedConf.getVar(ConfVars.PREEXECHOOKS).contains(DisallowTransformHook.class.getName())); // verify that some dummy param can be set processedConf.verifyAndSet("dummy.param", "dummy.val"); processedConf.verifyAndSet(ConfVars.HIVE_AUTHORIZATION_ENABLED.varname, "true"); }