Fix unsafe requests with remote user auth
This commit is contained in:
parent
2e2362e2df
commit
62b8be1a10
@ -47,3 +47,11 @@ class HttpRemoteUserMiddleware(PersistentRemoteUserMiddleware):
|
||||
"""
|
||||
|
||||
header = settings.HTTP_REMOTE_USER_HEADER_NAME
|
||||
|
||||
|
||||
class PaperlessRemoteUserAuthentication(authentication.RemoteUserAuthentication):
|
||||
"""
|
||||
REMOTE_USER authentication for DRF which overrides the default header.
|
||||
"""
|
||||
|
||||
header = settings.HTTP_REMOTE_USER_HEADER_NAME
|
||||
|
@ -429,8 +429,9 @@ HTTP_REMOTE_USER_HEADER_NAME = os.getenv(
|
||||
if ENABLE_HTTP_REMOTE_USER:
|
||||
MIDDLEWARE.append("paperless.auth.HttpRemoteUserMiddleware")
|
||||
AUTHENTICATION_BACKENDS.insert(0, "django.contrib.auth.backends.RemoteUserBackend")
|
||||
REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"].append(
|
||||
"rest_framework.authentication.RemoteUserAuthentication",
|
||||
REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"].insert(
|
||||
0,
|
||||
"paperless.auth.PaperlessRemoteUserAuthentication",
|
||||
)
|
||||
|
||||
# X-Frame options for embedded PDF display:
|
||||
|
Loading…
x
Reference in New Issue
Block a user