public TTransportFactory getAuthTransFactory() throws Exception {
   if (authType == AuthTypes.KERBEROS) {
     return saslServer.createTransportFactory(getSaslProperties(), saslMessageLimit);
   }
   if (authType == AuthTypes.NOSASL) {
     return new TTransportFactory();
   }
   return PlainSaslHelper.getPlainTransportFactory(authType.name(), saslMessageLimit);
 }
Пример #2
0
  /**
   * Test setting {@link HiveConf.ConfVars}} config parameter HIVE_SERVER2_ENABLE_DOAS for unsecure
   * mode
   */
  public void testDoAsSetting() {

    HiveConf hconf = new HiveConf();
    assertTrue(
        "default value of hive server2 doAs should be true",
        hconf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS));

    CLIService cliService = new CLIService();
    cliService.init(hconf);
    ThriftCLIService tcliService = new ThriftCLIService(cliService);
    tcliService.init(hconf);
    TProcessorFactory procFactory = PlainSaslHelper.getPlainProcessorFactory(tcliService);
    assertEquals(
        "doAs enabled processor for unsecure mode",
        procFactory.getProcessor(null).getClass(),
        TUGIContainingProcessor.class);
  }
 /**
  * Returns the thrift processor factory for HiveServer2 running in binary mode
  *
  * @param service
  * @return
  * @throws LoginException
  */
 public TProcessorFactory getAuthProcFactory(ThriftCLIService service) {
   if (authType == AuthTypes.KERBEROS) {
     return KerberosSaslHelper.getKerberosProcessorFactory(saslServer, service);
   }
   return PlainSaslHelper.getPlainProcessorFactory(service);
 }