diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index f3c166df88..091840a8bf 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -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 diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 71f6388c68..0ae6919669 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -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? diff --git a/requirements.txt b/requirements.txt index 049bedcbeb..ff0d84703a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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