add in SSO for #1421

This commit is contained in:
Matthias 2021-08-24 19:12:43 +02:00
parent 28878b4b0d
commit 1311558cac
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
3 changed files with 11 additions and 1 deletions

View File

@ -249,6 +249,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
# InvenTree apps
'build.apps.BuildConfig',
@ -279,6 +280,10 @@ INSTALLED_APPS = [
'error_report', # Error reporting in the admin interface
'django_q',
'formtools', # Form wizard tools
'allauth', # Base app for SSO
'allauth.account', # Extend user with accounts
'allauth.socialaccount', # Use 'social' providers
]
MIDDLEWARE = CONFIG.get('middleware', [
@ -298,7 +303,8 @@ MIDDLEWARE = CONFIG.get('middleware', [
MIDDLEWARE.append('error_report.middleware.ExceptionProcessor')
AUTHENTICATION_BACKENDS = CONFIG.get('authentication_backends', [
'django.contrib.auth.backends.ModelBackend'
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend', # SSO login via external providers
])
# If the debug toolbar is enabled, add the modules
@ -646,3 +652,5 @@ MESSAGE_TAGS = {
messages.ERROR: 'alert alert-block alert-danger',
messages.INFO: 'alert alert-block alert-info',
}
SITE_ID = 1

View File

@ -165,6 +165,7 @@ urlpatterns = [
url(r'^api-doc/', include_docs_urls(title='InvenTree API')),
url(r'^markdownx/', include('markdownx.urls')),
url(r'^accounts/', include('allauth.urls')), # SSO
]
# Server running in "DEBUG" mode?

View File

@ -34,5 +34,6 @@ python-barcode[images]==0.13.1 # Barcode generator
qrcode[pil]==6.1 # QR code generator
django-q==1.3.4 # Background task scheduling
django-formtools==2.3 # Form wizard tools
django-allauth==0.45.0 # SSO for external providers via OpenID
inventree # Install the latest version of the InvenTree API python library