From 762e6dd838149d2024139bb2c6c18fb7b5ab03b1 Mon Sep 17 00:00:00 2001 From: ruslan33 Date: Sun, 28 Apr 2024 22:32:11 +0200 Subject: [PATCH] Jwt auth branch (#30) * Create django.yml * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * Functional tests * JWT settings --- nopayloaddb/settings.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/nopayloaddb/settings.py b/nopayloaddb/settings.py index bc84ce8..be6479e 100644 --- a/nopayloaddb/settings.py +++ b/nopayloaddb/settings.py @@ -134,12 +134,12 @@ # 'DEFAULT_AUTHENTICATION_CLASSES': ( # 'rest_framework.authentication.TokenAuthentication', # ), - #'DEFAULT_AUTHENTICATION_CLASSES': ( - # 'cdb_rest.authentication.CustomJWTAuthentication', - #), - #'DEFAULT_PERMISSION_CLASSES': ( - # 'rest_framework.permissions.IsAuthenticated', - #), + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'cdb_rest.authentication.CustomJWTAuthentication', + ), + 'DEFAULT_PERMISSION_CLASSES': ( + 'rest_framework.permissions.IsAuthenticated', + ), 'TEST_REQUEST_DEFAULT_FORMAT': 'json', } @@ -164,13 +164,13 @@ ] SIMPLE_JWT = { - #'SIGNING_KEY': settings.SECRET_KEY, - #ZZ'VERIFYING_KEY':SECRET_KEY, + 'ALGORITHM': 'HS256', + 'SIGNING_KEY': os.environ.get("JWT_SECRET", default='secret'), + 'VERIFYING_KEY': None, 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',), - 'AUTH_HEADER_TYPES': ('JWT', 'Bearer'), + 'AUTH_HEADER_TYPES': ('Bearer',), + 'USER_ID_FIELD': 'id', 'USER_ID_CLAIM': 'user_id', - - #'JTI_CLAIM': 'jti', }