mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
made remote auth a config setting
This commit is contained in:
@@ -19,3 +19,8 @@ POSTGRES_DB=djangodb
|
|||||||
# provided that include an additional nxginx container to handle media file serving.
|
# provided that include an additional nxginx container to handle media file serving.
|
||||||
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
|
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
|
||||||
GUNICORN_MEDIA=0
|
GUNICORN_MEDIA=0
|
||||||
|
|
||||||
|
|
||||||
|
# allow authentication via reverse proxy (e.g. authelia), leave of if you dont know what you are doing
|
||||||
|
# docs: https://github.com/vabene1111/recipes/tree/develop/docs/docker/nginx-proxy%20with%20proxy%20authentication
|
||||||
|
REVERSE_PROXY_AUTH=0
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ DEBUG = bool(int(os.getenv('DEBUG', True)))
|
|||||||
|
|
||||||
GUNICORN_MEDIA = bool(int(os.getenv('GUNICORN_MEDIA', True)))
|
GUNICORN_MEDIA = bool(int(os.getenv('GUNICORN_MEDIA', True)))
|
||||||
|
|
||||||
|
REVERSE_PROXY_AUTH = bool(int(os.getenv('REVERSE_PROXY_AUTH', False)))
|
||||||
|
|
||||||
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS').split(',') if os.getenv('ALLOWED_HOSTS') else ['*']
|
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS').split(',') if os.getenv('ALLOWED_HOSTS') else ['*']
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = "index"
|
LOGIN_REDIRECT_URL = "index"
|
||||||
@@ -69,14 +71,16 @@ MIDDLEWARE = [
|
|||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.locale.LocaleMiddleware',
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'recipes.middleware.CustomRemoteUser',
|
]
|
||||||
]
|
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = [
|
AUTHENTICATION_BACKENDS = [
|
||||||
'django.contrib.auth.backends.RemoteUserBackend',
|
|
||||||
'django.contrib.auth.backends.ModelBackend',
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if REVERSE_PROXY_AUTH:
|
||||||
|
MIDDLEWARE.append('recipes.middleware.CustomRemoteUser')
|
||||||
|
AUTHENTICATION_BACKENDS.append('django.contrib.auth.backends.RemoteUserBackend')
|
||||||
|
|
||||||
ROOT_URLCONF = 'recipes.urls'
|
ROOT_URLCONF = 'recipes.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
|
|||||||
Reference in New Issue
Block a user