From 5c17943bcb1a902d05380734eeed1f8e679061cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20=22decko=22=20de=20Brito?= Date: Fri, 20 Sep 2024 16:29:49 -0300 Subject: [PATCH] Add an `authenticate_header` method Closes #5819 --- CHANGES/5819.bugfix | 1 + pulpcore/app/authentication.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 CHANGES/5819.bugfix diff --git a/CHANGES/5819.bugfix b/CHANGES/5819.bugfix new file mode 100644 index 0000000000..3adab56b0d --- /dev/null +++ b/CHANGES/5819.bugfix @@ -0,0 +1 @@ +Add an `authentication_header` method to make JSONHeaderRemoteAuthentication return proper 401 when the request is not properly authenticated. diff --git a/pulpcore/app/authentication.py b/pulpcore/app/authentication.py index 93b0be8ce9..6187506e2b 100644 --- a/pulpcore/app/authentication.py +++ b/pulpcore/app/authentication.py @@ -72,3 +72,6 @@ def authenticate(self, request): _logger.debug(_("User {user} authenticated.").format(user=remote_user)) return (user, None) + + def authenticate_header(self, request): + return "JSONHeaderRemoteAuthentication"