Beispiel #1
0
  def _get_security(cls):
    principal = get_server_principal()
    if principal:
      kerberos_principal_short_name = principal.split('/', 1)[0]
    else:
      kerberos_principal_short_name = None
    use_sasl = get_server_authentication() == 'KERBEROS'

    return {
        'kerberos_principal_short_name': kerberos_principal_short_name,
        'use_sasl': use_sasl,
    }
Beispiel #2
0
Datei: api.py Projekt: tp0101/hue
    def _get_security(cls):
        principal = get_server_principal()
        if principal:
            kerberos_principal_short_name = principal.split('/', 1)[0]
        else:
            kerberos_principal_short_name = None
        use_sasl = get_server_authentication() == 'KERBEROS'

        return {
            'kerberos_principal_short_name': kerberos_principal_short_name,
            'use_sasl': use_sasl,
        }
Beispiel #3
0
Datei: api.py Projekt: QLGu/hue
  def _get_security(cls):
    principal = get_server_principal()
    if principal:
      kerberos_principal_short_name = principal.split('/', 1)[0]
    else:
      kerberos_principal_short_name = None
    use_sasl = get_server_authentication() == 'KERBEROS'

    if use_sasl and kerberos_principal_short_name is None:
      raise PopupException(_("The kerberos principal name is missing from the hbase-site.xml configuration file."))

    return {
        'kerberos_principal_short_name': kerberos_principal_short_name,
        'use_sasl': use_sasl,
    }
Beispiel #4
0
Datei: api.py Projekt: ztwu/hue
  def _get_security(cls):
    principal = get_server_principal()
    if principal:
      kerberos_principal_short_name = principal.split('/', 1)[0]
    else:
      kerberos_principal_short_name = None
    use_sasl = get_server_authentication() == 'KERBEROS'

    if use_sasl and kerberos_principal_short_name is None:
      raise PopupException(_("The kerberos principal name is missing from the hbase-site.xml configuration file."))

    return {
        'kerberos_principal_short_name': kerberos_principal_short_name,
        'use_sasl': use_sasl,
    }
Beispiel #5
0
def test_security_kerberos():
  tmpdir = tempfile.mkdtemp()
  finish = HBASE_CONF_DIR.set_for_testing(tmpdir)

  try:
    xml = hbase_site_xml(authentication='kerberos')
    file(os.path.join(tmpdir, 'hbase-site.xml'), 'w').write(xml)
    reset()

    assert_equal('KERBEROS', get_server_authentication())
    assert_equal('test', get_server_principal())

    security = HbaseApi._get_security()

    assert_equal('test', security['kerberos_principal_short_name'])
    assert_equal(True, security['use_sasl'])
  finally:
    reset()
    finish()
    shutil.rmtree(tmpdir)
Beispiel #6
0
def test_security_kerberos():
    tmpdir = tempfile.mkdtemp()
    finish = HBASE_CONF_DIR.set_for_testing(tmpdir)

    try:
        xml = hbase_site_xml(authentication='kerberos')
        file(os.path.join(tmpdir, 'hbase-site.xml'), 'w').write(xml)
        reset()

        assert_equal('KERBEROS', get_server_authentication())
        assert_equal('test', get_server_principal())

        security = HbaseApi._get_security()

        assert_equal('test', security['kerberos_principal_short_name'])
        assert_equal(True, security['use_sasl'])
    finally:
        reset()
        finish()
        shutil.rmtree(tmpdir)