diff --git a/src/paperless/auth.py b/src/paperless/auth.py index 6ca97d608..01836463c 100644 --- a/src/paperless/auth.py +++ b/src/paperless/auth.py @@ -55,6 +55,12 @@ class HttpRemoteUserMiddleware(PersistentRemoteUserMiddleware): def process_request(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. + logger.debug( + request.path, + ) + logger.debug( + settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"], + ) if ( "/api/" in request.path and "paperless.auth.PaperlessRemoteUserAuthentication" diff --git a/src/paperless/tests/test_remote_user.py b/src/paperless/tests/test_remote_user.py index ac45056e4..4e9c11dc9 100644 --- a/src/paperless/tests/test_remote_user.py +++ b/src/paperless/tests/test_remote_user.py @@ -92,7 +92,7 @@ class TestRemoteUser(DirectoriesMixin, APITestCase): """ GIVEN: - Configured user - - Remote user auth is disabled for the API + - Remote user auth enabled for frontend but disabled for the API WHEN: - API call is made to get documents THEN: @@ -108,14 +108,6 @@ class TestRemoteUser(DirectoriesMixin, APITestCase): ): _parse_remote_user_settings() - response = self.client.get("/api/documents/") - - # 403 testing locally, 401 on ci... - self.assertIn( - response.status_code, - [status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN], - ) - response = self.client.get( "/api/documents/", headers={