瀏覽代碼

Merge pull request #199 from stockholmuniversity/replace_kerberos_with_spnego

Replace kerberos with spnego
Matt Phillips 4 年之前
父節點
當前提交
8096e08964
共有 4 個文件被更改,包括 8 次插入4 次删除
  1. 3 1
      pepper/cli.py
  2. 2 2
      pepper/libpepper.py
  3. 3 0
      setup.py
  4. 0 1
      tests/conftest.py

+ 3 - 1
pepper/cli.py

@@ -411,7 +411,9 @@ class PepperCli(object):
         else:
             if self.options.username is not None:
                 results['SALTAPI_USER'] = self.options.username
-        if self.options.password is None and results['SALTAPI_PASS'] is None:
+        if self.options.password is None and \
+                results['SALTAPI_PASS'] is None and \
+                results['SALTAPI_EAUTH'] != 'kerberos':
             if self.options.interactive:
                 results['SALTAPI_PASS'] = getpass.getpass(prompt='Password: ')
             else:

+ 2 - 2
pepper/libpepper.py

@@ -267,8 +267,8 @@ class Pepper(object):
 
         '''
         import requests
-        from requests_kerberos import HTTPKerberosAuth, OPTIONAL
-        auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
+        from requests_gssapi import HTTPSPNEGOAuth, OPTIONAL
+        auth = HTTPSPNEGOAuth(mutual_authentication=OPTIONAL)
         headers = {
             'Accept': 'application/json',
             'Content-Type': 'application/json',

+ 3 - 0
setup.py

@@ -38,6 +38,9 @@ setup_kwargs = {
     'packages': [
         'pepper',
     ],
+    'extras_require': {
+        'kerberos': ["requests-gssapi>=1.1.0"],
+    },
     'scripts': [
         'scripts/pepper',
     ]

+ 0 - 1
tests/conftest.py

@@ -89,7 +89,6 @@ def pepperconfig(salt_api_port):
         SALTAPI_EAUTH=sharedsecret
         [noopts]
         SALTAPI_URL=http://localhost:{0}/
-        SALTAPI_EAUTH=kerberos
     '''.format(salt_api_port))
     with open('tests/.pepperrc', 'w') as pepper_file:
         print(config, file=pepper_file)