SMART-31 added JWT settings to settings.py
This commit is contained in:
parent
fb19e6ec6a
commit
6002ba94ec
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,12 +10,12 @@ For the full list of settings and their values, see
|
|||||||
https://docs.djangoproject.com/en/3.1/ref/settings/
|
https://docs.djangoproject.com/en/3.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
|
|
||||||
@ -27,7 +27,6 @@ DEBUG = True
|
|||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
@ -72,7 +71,6 @@ TEMPLATES = [
|
|||||||
|
|
||||||
WSGI_APPLICATION = 'smartpicasso.wsgi.application'
|
WSGI_APPLICATION = 'smartpicasso.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
||||||
|
|
||||||
@ -83,7 +81,6 @@ DATABASES = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
@ -102,7 +99,6 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/3.1/topics/i18n/
|
# https://docs.djangoproject.com/en/3.1/topics/i18n/
|
||||||
|
|
||||||
@ -116,8 +112,47 @@ USE_L10N = True
|
|||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'user.User'
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
|
'rest_framework.permissions.IsAuthenticated',
|
||||||
|
'rest_framework.permissions.IsAdminUser'
|
||||||
|
],
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||||
|
'rest_framework_jwt.authentication.JSONWebTokenAuthentication'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
JWT_AUTH = {
|
||||||
|
'JWT_ENCODE_HANDLER':
|
||||||
|
'rest_framework_jwt.utils.jwt_encode_handler',
|
||||||
|
'JWT_DECODE_HANDLER':
|
||||||
|
'rest_framework_jwt.utils.jwt_decode_handler',
|
||||||
|
'JWT_PAYLOAD_HANDLER':
|
||||||
|
'rest_framework_jwt.utils.jwt_payload_handler',
|
||||||
|
'JWT_PAYLOAD_GET_USER_ID_HANDLER':
|
||||||
|
'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler',
|
||||||
|
'JWT_RESPONSE_PAYLOAD_HANDLER':
|
||||||
|
'rest_framework_jwt.utils.jwt_response_payload_handler',
|
||||||
|
|
||||||
|
'JWT_SECRET_KEY': 'SECRET_KEY',
|
||||||
|
'JWT_GET_USER_SECRET_KEY': None,
|
||||||
|
'JWT_PUBLIC_KEY': None,
|
||||||
|
'JWT_PRIVATE_KEY': None,
|
||||||
|
'JWT_ALGORITHM': 'HS256',
|
||||||
|
'JWT_VERIFY': True,
|
||||||
|
'JWT_VERIFY_EXPIRATION': True,
|
||||||
|
'JWT_LEEWAY': 0,
|
||||||
|
'JWT_EXPIRATION_DELTA': timedelta(days=30),
|
||||||
|
'JWT_AUDIENCE': None,
|
||||||
|
'JWT_ISSUER': None,
|
||||||
|
'JWT_ALLOW_REFRESH': False,
|
||||||
|
'JWT_REFRESH_EXPIRATION_DELTA': timedelta(days=30),
|
||||||
|
'JWT_AUTH_HEADER_PREFIX': 'Bearer',
|
||||||
|
'JWT_AUTH_COOKIE': None,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user