From 65966fed88f647062c622e75a77b83934cb8e724 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: May 12 2024 23:38:31 +0000 Subject: Use python-requests-gssapi instead of -kerberos Koji CLI requires the gssapi library, so let's unify to pull one less dependency to user systems. Signed-off-by: Lubomír Sedlář --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index bf0e11d..573fc36 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -4131,14 +4131,14 @@ class Commands(object): url, http_method=verb.upper(), json=body, scopes=oidc_scopes, **kwargs) elif auth_method == 'kerberos': - import requests_kerberos + import requests_gssapi if type(body) is dict: data = json.dumps(body) else: data = body - auth = requests_kerberos.HTTPKerberosAuth( - mutual_authentication=requests_kerberos.OPTIONAL) + auth = requests_gssapi.HTTPSPNEGOAuth( + mutual_authentication=requests_gssapi.OPTIONAL) resp = requests.request(verb, url, data=data, auth=auth, **kwargs) if resp.status_code == 401: raise rpkgError('MBS authentication using Kerberos failed. ' diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py index a094c8d..97c2904 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -2813,10 +2813,10 @@ class cliClient(object): # Try to import this now so the user gets immediate feedback if # it isn't installed try: - import requests_kerberos # noqa: F401 + import requests_gssapi # noqa: F401 except ImportError: raise rpkgError( - 'python-requests-kerberos needs to be installed') + 'python-requests-gssapi needs to be installed') for required_config in required_configs: if not self.config.has_option(self.config_section, diff --git a/requirements/fedora-py2.txt b/requirements/fedora-py2.txt index 58b994d..ae24efa 100644 --- a/requirements/fedora-py2.txt +++ b/requirements/fedora-py2.txt @@ -9,7 +9,7 @@ python2-rpm # rpm-python originally python2-requests PyYAML # python2-openidc-client # used for MBS OIDC authentication -# python2-requests-kerberos # used for MBS Kerberos authentication +# python2-requests-gssapi # used for MBS Kerberos authentication # For running tests python2-coverage diff --git a/requirements/fedora-py3.txt b/requirements/fedora-py3.txt index 7c366ea..0cd8979 100644 --- a/requirements/fedora-py3.txt +++ b/requirements/fedora-py3.txt @@ -9,7 +9,7 @@ python3-rpm # rpm-python originally python3-requests python3-yaml # python3-openidc-client # used for MBS OIDC authentication -# python3-requests-kerberos # used for MBS Kerberos authentication +# python3-requests-gssapi # used for MBS Kerberos authentication # For running tests python3-coverage diff --git a/requirements/pypi.txt b/requirements/pypi.txt index 634e966..350454e 100644 --- a/requirements/pypi.txt +++ b/requirements/pypi.txt @@ -16,4 +16,4 @@ argcomplete # python -c "$(curl -fsSL https://raw.githubusercontent.com/junaruga/rpm-py-installer/master/install.py)" # openidc-client # used for MBS OIDC authentication -# requests-kerberos # used for MBS Kerberos authentication +# requests-gssapi # used for MBS Kerberos authentication