From a1b023cd4e20580a5e200bb430ef3c7d66885cd0 Mon Sep 17 00:00:00 2001 From: icurfer Date: Tue, 20 May 2025 00:47:07 +0900 Subject: [PATCH] =?UTF-8?q?jwt=20token=20=EC=A0=9C=EC=96=B4=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth_prj/settings.py | 21 ++++++++++----------- version | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/auth_prj/settings.py b/auth_prj/settings.py index 14b13dc..7c6ae75 100644 --- a/auth_prj/settings.py +++ b/auth_prj/settings.py @@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/ import os from dotenv import load_dotenv from pathlib import Path +from datetime import timedelta # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -48,13 +49,15 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - # by.sdjo 2025-04-22 + # by.sdjo 'rest_framework', 'rest_framework_simplejwt', + 'rest_framework_simplejwt.token_blacklist', 'drf_yasg', 'corsheaders', # create by.sdjo 2025-04-22 'users', # 2025-04-22 custom app create + ] AUTH_USER_MODEL = 'users.CustomUser' @@ -114,16 +117,12 @@ TEMPLATES = [ WSGI_APPLICATION = 'auth_prj.wsgi.application' - -# Database -# https://docs.djangoproject.com/en/4.2/ref/settings/#databases - -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.sqlite3', -# 'NAME': BASE_DIR / 'db.sqlite3', -# } -# } +SIMPLE_JWT = { + "ACCESS_TOKEN_LIFETIME": timedelta(minutes=5), + "REFRESH_TOKEN_LIFETIME": timedelta(days=1), + "ROTATE_REFRESH_TOKENS": True, + "BLACKLIST_AFTER_ROTATION": True, # 사용한 토큰은 갱신하면 블랙리스트처리됨 +} DATABASES = { "default": { diff --git a/version b/version index b5e3332..5c4511c 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.0.6-r1 \ No newline at end of file +0.0.7 \ No newline at end of file