mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Port from python-kerberos to python-gssapi
kerberos library doesn't support Python 3 and probably never will. python-gssapi library is Python 3 compatible. https://fedorahosted.org/freeipa/ticket/5147 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Robbie Harwood <rharwood@redhat.com> Reviewed-By: Simo Sorce <ssorce@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
3257ac6b87
commit
f0b4c4487e
@@ -63,15 +63,12 @@ def json_serialize(obj):
|
||||
|
||||
def get_current_principal():
|
||||
try:
|
||||
import kerberos
|
||||
rc, vc = kerberos.authGSSClientInit("notempty")
|
||||
rc = kerberos.authGSSClientInquireCred(vc)
|
||||
username = kerberos.authGSSClientUserName(vc)
|
||||
kerberos.authGSSClientClean(vc)
|
||||
return unicode(username)
|
||||
import gssapi
|
||||
cred = gssapi.Credentials(usage='initiate')
|
||||
return unicode(cred.name)
|
||||
except ImportError:
|
||||
raise RuntimeError('python-kerberos is not available.')
|
||||
except kerberos.GSSError, e:
|
||||
raise RuntimeError('python-gssapi is not available.')
|
||||
except gssapi.exceptions.GSSError:
|
||||
#TODO: do a kinit?
|
||||
raise errors.CCacheError()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user