Fixhancement: only offer basic auth for appropriate requests (#12362)

This commit is contained in:
shamoon authored and GitHub committed 2026-03-16 22:07:12 -07:00
1 parent 1e00ad5f30
commit 7942edfdf4
5 files changed
+213

No files matched your search

+8
View File
@@ -83,3 +83,11 @@ class PaperlessBasicAuthentication(authentication.BasicAuthentication):
raise exceptions.AuthenticationFailed("MFA required")
return user_tuple
def authenticate_header(self, request):
auth_header = request.META.get("HTTP_AUTHORIZATION", "")
if auth_header.lower().startswith("basic "):
return super().authenticate_header(request)
# Still 401 for anonymous API access
return authentication.TokenAuthentication.keyword