Implement basic auth

This commit is contained in:
Xeryus Stokkel 2022-01-13 14:09:32 +01:00
parent 5e68cf44e4
commit 43c7ef837f
Signed by: Xeryus Stokkel
GPG Key ID: 7023C2C891DDE681
4 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,8 @@
asgiref==3.4.1
Django==3.2
django-basicauth==0.5.3
django-scim2==0.17.0
gunicorn==20.1.0
psycopg2-binary==2.9.3
python-dateutil==2.8.2
pytz==2021.3

View File

@ -25,7 +25,10 @@ SECRET_KEY = 'django-insecure-zzde2t39t5d7xhj&=yq+@ox3w(*euu-^&1v0g(wo0fcyapn0m%
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = [
'localhost',
'scim.xeryus.rug.nl',
]
# Application definition
@ -47,6 +50,7 @@ MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'basicauth.middleware.BasicAuthMiddleware',
'django_scim.middleware.SCIMAuthCheckMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
@ -138,3 +142,11 @@ SCIM_SERVICE_PROVIDER = {
},
],
}
STATIC_ROOT = '/var/www/scim_app/static'
STATIC_URL = '/static/'
BASICAUTH_USERS = {
'xeryus': 'development',
'scim': 'scim',
}

View File

@ -16,7 +16,10 @@ Including another URLconf
from django.contrib import admin
from django.urls import include, path
from . import views
urlpatterns = [
path('auth/', views.AuthView.as_view()),
path('admin/', admin.site.urls),
path('scim/v2/', include('django_scim.urls')),
]

View File

@ -0,0 +1,7 @@
from django.utils.decorators import method_decorator
from django.views.generic import View
from basicauth.decorators import basic_auth_required
@method_decorator(basic_auth_required, name='dispatch')
class AuthView(View):
pass