Refactor kerberos-sspi and principal handling.

This commit is contained in:
Carson Lam 2016-05-17 13:28:51 -07:00
parent 3a533dd3b8
commit 524e8579d0
1 changed files with 5 additions and 5 deletions

View File

@ -122,12 +122,12 @@ class HTTPKerberosAuth(AuthBase):
kerb_host = self.hostname_override if self.hostname_override is not None else host
kerb_spn = "{0}@{1}".format(self.service, kerb_host)
kwargs = {'principal': self.principal}
kwargs = {}
# kerberos-sspi: Never pass principal. Raise if user tries to specify one.
if self._using_kerberos_sspi:
kwargs = {}
if self.principal:
raise NotImplementedError("Can't use 'principal' argument with kerberos-sspi.")
if not self._using_kerberos_sspi:
kwargs['principal'] = self.principal
elif self.principal:
raise NotImplementedError("Can't use 'principal' argument with kerberos-sspi.")
result, self.context[host] = kerberos.authGSSClientInit(kerb_spn,
gssflags=gssflags, **kwargs)