Java Code Examples for org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthzSessionContext#getClientType()
The following examples show how to use
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthzSessionContext#getClientType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SentryAuthorizerFactory.java From incubator-sentry with Apache License 2.0 | 5 votes |
private HiveAuthzSessionContext applyTestSettings(HiveAuthzSessionContext ctx, HiveConf conf) { if (conf.getBoolVar(ConfVars.HIVE_TEST_AUTHORIZATION_SQLSTD_HS2_MODE) && ctx.getClientType() == CLIENT_TYPE.HIVECLI) { // create new session ctx object with HS2 as client type HiveAuthzSessionContext.Builder ctxBuilder = new HiveAuthzSessionContext.Builder(ctx); ctxBuilder.setClientType(CLIENT_TYPE.HIVESERVER2); return ctxBuilder.build(); } return ctx; }
Example 2
Source File: SentryAuthorizerFactory.java From incubator-sentry with Apache License 2.0 | 5 votes |
private void assertHiveCliAuthDisabled(HiveConf conf, HiveAuthzSessionContext ctx) throws HiveAuthzPluginException { if (ctx.getClientType() == CLIENT_TYPE.HIVECLI && conf.getBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED)) { throw new HiveAuthzPluginException( "SQL standards based authorization should not be enabled from hive cli" + "Instead the use of storage based authorization in hive metastore is reccomended. Set " + ConfVars.HIVE_AUTHORIZATION_ENABLED.varname + "=false to disable authz within cli"); } }
Example 3
Source File: RangerHiveAuthorizer.java From ranger with Apache License 2.0 | 4 votes |
public RangerHiveAuthorizer(HiveMetastoreClientFactory metastoreClientFactory, HiveConf hiveConf, HiveAuthenticationProvider hiveAuthenticator, HiveAuthzSessionContext sessionContext) { super(metastoreClientFactory, hiveConf, hiveAuthenticator, sessionContext); LOG.debug("RangerHiveAuthorizer.RangerHiveAuthorizer()"); RangerHivePlugin plugin = hivePlugin; if(plugin == null) { synchronized(RangerHiveAuthorizer.class) { plugin = hivePlugin; if(plugin == null) { String appType = "unknown"; if(sessionContext != null) { switch(sessionContext.getClientType()) { case HIVECLI: appType = "hiveCLI"; break; case HIVESERVER2: appType = "hiveServer2"; break; /* case HIVEMETASTORE: appType = "hiveMetastore"; break; case OTHER: appType = "other"; break; */ } } plugin = new RangerHivePlugin(appType); plugin.init(); hivePlugin = plugin; } } } }