2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Merge pull request #930 from bcc/feature-custom-authentication

Allow custom authentication/middleware in config.yaml
This commit is contained in:
Oliver 2020-08-25 08:37:30 +10:00 committed by GitHub
commit cd016d3f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -163,7 +163,7 @@ LOGGING = {
}, },
} }
MIDDLEWARE = [ MIDDLEWARE = CONFIG.get('middleware', [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
@ -173,9 +173,12 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'InvenTree.middleware.AuthRequiredMiddleware' 'InvenTree.middleware.AuthRequiredMiddleware'
] ])
AUTHENTICATION_BACKENDS = CONFIG.get('authentication_backends', [
'django.contrib.auth.backends.ModelBackend'
])
# If the debug toolbar is enabled, add the modules # If the debug toolbar is enabled, add the modules
if DEBUG and CONFIG.get('debug_toolbar', False): if DEBUG and CONFIG.get('debug_toolbar', False):

View File

@ -86,4 +86,21 @@ latex:
enabled: False enabled: False
interpreter: pdflatex interpreter: pdflatex
# Extra options to pass through to the LaTeX interpreter # Extra options to pass through to the LaTeX interpreter
options: '' options: ''
# Permit custom authentication backends
#authentication_backends:
# - 'django.contrib.auth.backends.ModelBackend'
# Custom middleware, sometimes needed alongside an authentication backend change.
#middleware:
# - 'django.middleware.security.SecurityMiddleware'
# - 'django.contrib.sessions.middleware.SessionMiddleware'
# - 'django.middleware.locale.LocaleMiddleware'
# - 'django.middleware.common.CommonMiddleware'
# - 'django.middleware.csrf.CsrfViewMiddleware'
# - 'corsheaders.middleware.CorsMiddleware'
# - 'django.contrib.auth.middleware.AuthenticationMiddleware'
# - 'django.contrib.messages.middleware.MessageMiddleware'
# - 'django.middleware.clickjacking.XFrameOptionsMiddleware'
# - 'InvenTree.middleware.AuthRequiredMiddleware'