コード例 #1
0
ファイル: client2.py プロジェクト: CaeserNieh/hue
  def _get_security(self):
    principal = get_sentry_server_principal()
    if principal:
      kerberos_principal_short_name = principal.split('/', 1)[0]
    else:
      kerberos_principal_short_name = None
    use_sasl = get_sentry_server_authentication() == 'KERBEROS'
    mechanism = SentryClient.SENTRY_MECHANISMS[get_sentry_server_authentication()]

    return {
        'kerberos_principal_short_name': kerberos_principal_short_name,
        'use_sasl': use_sasl,
        'mechanism': mechanism
    }
コード例 #2
0
  def _get_security(self):
    principal = get_sentry_server_principal()
    if principal:
      kerberos_principal_short_name = principal.split('/', 1)[0]
    else:
      kerberos_principal_short_name = None
    use_sasl = get_sentry_server_authentication() == 'KERBEROS'
    mechanism = SentryClient.SENTRY_MECHANISMS[get_sentry_server_authentication()]

    return {
        'kerberos_principal_short_name': kerberos_principal_short_name,
        'use_sasl': use_sasl,
        'mechanism': mechanism
    }
コード例 #3
0
ファイル: test_client.py プロジェクト: 277800076/hue
def test_security_plain():
  tmpdir = tempfile.mkdtemp()
  finish = SENTRY_CONF_DIR.set_for_testing(tmpdir)

  try:
    xml = sentry_site_xml(provider='default')
    file(os.path.join(tmpdir, 'sentry-site.xml'), 'w').write(xml)
    sentry_site.reset()

    assert_equal('test/[email protected]', get_sentry_server_principal())
    assert_equal(['hive', 'impala', 'hue'], get_sentry_server_admin_groups())

    security = SentryClient('test.com', 11111, 'test')._get_security()

    assert_equal('test', security['kerberos_principal_short_name'])
    assert_equal(False, security['use_sasl'])
    assert_equal('NOSASL', security['mechanism'])
  finally:
    sentry_site.reset()
    finish()
    shutil.rmtree(tmpdir)
コード例 #4
0
def test_security_plain():
    tmpdir = tempfile.mkdtemp()
    finish = SENTRY_CONF_DIR.set_for_testing(tmpdir)

    try:
        xml = sentry_site_xml(provider='default')
        file(os.path.join(tmpdir, 'sentry-site.xml'), 'w').write(xml)
        sentry_site.reset()

        assert_equal('test/[email protected]', get_sentry_server_principal())
        assert_equal(['hive', 'impala', 'hue'],
                     get_sentry_server_admin_groups())

        security = SentryClient('test.com', 11111, 'test')._get_security()

        assert_equal('test', security['kerberos_principal_short_name'])
        assert_equal(False, security['use_sasl'])
        assert_equal('NOSASL', security['mechanism'])
    finally:
        sentry_site.reset()
        finish()
        shutil.rmtree(tmpdir)