From 9e6719fffa55c14fac537fff38bf57c577c24650 Mon Sep 17 00:00:00 2001 From: arturo-seijas <102022572+arturo-seijas@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:46:14 +0200 Subject: [PATCH] Enable JWT rotation (#50) --- app/settings.py | 8 ++++++++ httprequest_lego_provider/tests/settings.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/app/settings.py b/app/settings.py index dfeb871..ed248d1 100644 --- a/app/settings.py +++ b/app/settings.py @@ -10,6 +10,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/ """ +import datetime import json import os import urllib @@ -147,6 +148,13 @@ ], } +SIMPLE_JWT = { + "ACCESS_TOKEN_LIFETIME": datetime.timedelta(days=1), + "REFRESH_TOKEN_LIFETIME": datetime.timedelta(days=7), + "ROTATE_REFRESH_TOKENS": True, + "SIGNING_KEY": SECRET_KEY, +} + LOGGING = { "version": 1, "disable_existing_loggers": False, diff --git a/httprequest_lego_provider/tests/settings.py b/httprequest_lego_provider/tests/settings.py index b19d41c..7219e1d 100644 --- a/httprequest_lego_provider/tests/settings.py +++ b/httprequest_lego_provider/tests/settings.py @@ -4,6 +4,7 @@ # pylint:disable=wildcard-import,unused-wildcard-import +import datetime import os import secrets from pathlib import Path @@ -32,3 +33,10 @@ "NAME": os.path.join(BASE_DIR, "db.sqlite3"), } } + +SIMPLE_JWT = { + "ACCESS_TOKEN_LIFETIME": datetime.timedelta(days=1), + "REFRESH_TOKEN_LIFETIME": datetime.timedelta(days=7), + "ROTATE_REFRESH_TOKENS": True, + "SIGNING_KEY": SECRET_KEY, +}