From b68b7a713a2acbbb6e0ce7bc9b8ef43fb913a2a8 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 23 Jun 2022 19:13:25 +0200 Subject: [PATCH] Replace old requests_kerberos with requests_gssapi Signed-off-by: Andreas Schneider --- cepces/soap/auth.py | 8 +++++--- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cepces/soap/auth.py b/cepces/soap/auth.py index bb5536d..26f549e 100644 --- a/cepces/soap/auth.py +++ b/cepces/soap/auth.py @@ -21,7 +21,8 @@ """This module contains SOAP related authentication.""" from abc import ABCMeta, abstractmethod, abstractproperty import os -from requests_kerberos import HTTPKerberosAuth +import gssapi +from requests_gssapi import HTTPSPNEGOAuth from cepces import Base from cepces.krb5 import types as ktypes from cepces.krb5.core import Context, Keytab, Principal @@ -117,8 +118,9 @@ def _init_ccache(self): os.environ["KRB5CCNAME"] = ccache_name def _init_transport(self): - self._transport = HTTPKerberosAuth(principal=self._config['name'], - delegate=True) + name = gssapi.Name(self._config['name'], gssapi.NameType.user) + creds = gssapi.Credentials(name=name, usage="initiate") + self._transport = HTTPSPNEGOAuth(creds=creds, delegate=True) @property def transport(self): diff --git a/requirements.txt b/requirements.txt index e111f9d..eb560d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ cryptography>=1.2 requests -requests_kerberos>=0.9 +requests_gssapi>=1.2.2