From 98b981039f0830acf18097228483a5e5d7792196 Mon Sep 17 00:00:00 2001 From: juanifioren Date: Wed, 4 Dec 2024 16:12:23 -0300 Subject: [PATCH] Work on end_session_endpoint --- .vscode/settings.json | 2 +- example/app/settings.py | 75 ++++++++++--------- .../templates/oidc_provider/authorize.html | 6 +- 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 171bc2c7..ab96ebe3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "[python]": { "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.sortImports": "explicit" } }, "python.formatting.provider": "black", diff --git a/example/app/settings.py b/example/app/settings.py index 1c3e9722..4332fd43 100644 --- a/example/app/settings.py +++ b/example/app/settings.py @@ -1,74 +1,75 @@ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os + BASE_DIR = os.path.dirname(os.path.dirname(__file__)) -SECRET_KEY = 'c14d549c574e4d8cf162404ef0b04598' +SECRET_KEY = "c14d549c574e4d8cf162404ef0b04598" DEBUG = True TEMPLATE_DEBUG = False -ALLOWED_HOSTS = ['*'] +ALLOWED_HOSTS = ["*"] # Application definition INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'app', - 'oidc_provider', + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "app", + "oidc_provider", ] MIDDLEWARE_CLASSES = [ - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'oidc_provider.middleware.SessionManagementMiddleware', + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", + "oidc_provider.middleware.SessionManagementMiddleware", ] MIDDLEWARE = MIDDLEWARE_CLASSES TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], }, }, ] -ROOT_URLCONF = 'app.urls' +ROOT_URLCONF = "app.urls" -WSGI_APPLICATION = 'app.wsgi.application' +WSGI_APPLICATION = "app.wsgi.application" # Database DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'DATABASE.sqlite3'), + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": os.path.join(BASE_DIR, "DATABASE.sqlite3"), } } # Internationalization -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = "en-us" -TIME_ZONE = 'UTC' +TIME_ZONE = "UTC" USE_I18N = True @@ -78,14 +79,14 @@ # Static files (CSS, JavaScript, Images) -STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static/') +STATIC_URL = "/static/" +STATIC_ROOT = os.path.join(BASE_DIR, "static/") # Custom settings -LOGIN_REDIRECT_URL = '/' +LOGIN_REDIRECT_URL = "/" # OIDC Provider settings -SITE_URL = 'http://localhost:8000' +SITE_URL = "http://localhost:8000" OIDC_SESSION_MANAGEMENT_ENABLE = True diff --git a/example/app/templates/oidc_provider/authorize.html b/example/app/templates/oidc_provider/authorize.html index 001896ad..c5fae6ec 100644 --- a/example/app/templates/oidc_provider/authorize.html +++ b/example/app/templates/oidc_provider/authorize.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load i18n staticfiles %} +{% load i18n static %} {% block content %} @@ -16,10 +16,10 @@

{% trans 'Request for Permission' %}

{% endfor %}
- + -{% endblock %} +{% endblock %} \ No newline at end of file