|
|
@@ -27,7 +27,7 @@ from desktop import conf
|
|
|
|
|
|
from requests import exceptions
|
|
|
from requests.auth import HTTPBasicAuth
|
|
|
-from requests_kerberos import HTTPKerberosAuth, OPTIONAL
|
|
|
+from requests_kerberos import HTTPKerberosAuth, REQUIRED, OPTIONAL, DISABLED
|
|
|
from requests.packages.urllib3.contrib import pyopenssl
|
|
|
|
|
|
pyopenssl.DEFAULT_SSL_CIPHER_LIST = conf.SSL_CIPHER_LIST.get()
|
|
|
@@ -108,7 +108,15 @@ class HttpClient(object):
|
|
|
|
|
|
def set_kerberos_auth(self):
|
|
|
"""Set up kerberos auth for the client, based on the current ticket."""
|
|
|
- self._session.auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
|
|
|
+ mutual_auth = conf.KERBEROS.MUTUAL_AUTHENTICATION.get()
|
|
|
+ if mutual_auth == 'OPTIONAL':
|
|
|
+ self._session.auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
|
|
|
+ elif mutual_auth == 'REQUIRED':
|
|
|
+ self._session.auth = HTTPKerberosAuth(mutual_authentication=REQUIRED)
|
|
|
+ elif mutual_auth == 'DISABLED':
|
|
|
+ self._session.auth = HTTPKerberosAuth(mutual_authentication=DISABLED)
|
|
|
+ else:
|
|
|
+ self._session.auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
|
|
|
return self
|
|
|
|
|
|
def set_basic_auth(self, username, password):
|