header = settings.HTTP_REMOTE_USER_HEADER_NAME
- def process_request(self, request: HttpRequest) -> None:
+ def __call__(self, request: HttpRequest) -> None:
# If remote user auth is enabled only for the frontend, not the API,
# then we need dont want to authenticate the user for API requests.
if (
and "paperless.auth.PaperlessRemoteUserAuthentication"
not in settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"]
):
- return
- return super().process_request(request)
+ return self.get_response(request)
+ return super().__call__(request)
class PaperlessRemoteUserAuthentication(authentication.RemoteUserAuthentication):
import os
from unittest import mock
+from django.conf import settings
from django.contrib.auth.models import User
from django.test import override_settings
from rest_framework import status
@override_settings(
REST_FRAMEWORK={
+ **settings.REST_FRAMEWORK,
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework.authentication.BasicAuthentication",
"rest_framework.authentication.TokenAuthentication",