From b67005c7abb5f0d10c873afaee344e0db7d15c9a Mon Sep 17 00:00:00 2001 From: NEZRI Ygal Date: Fri, 19 Jul 2024 17:26:59 +0200 Subject: [PATCH] API Key Creation & Management Added functionality for superusers and users to create and manage API keys, with Knox integration for secure key hashing. --- Watcher/Watcher/watcher/settings.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Watcher/Watcher/watcher/settings.py b/Watcher/Watcher/watcher/settings.py index f8b3036..bcaaa8c 100755 --- a/Watcher/Watcher/watcher/settings.py +++ b/Watcher/Watcher/watcher/settings.py @@ -14,6 +14,7 @@ import ldap from django_auth_ldap.config import LDAPSearch +from datetime import timedelta # LDAP Setup AUTH_LDAP_SERVER_URI = os.environ.get('AUTH_LDAP_SERVER_URI', "") @@ -149,6 +150,11 @@ ('knox.auth.TokenAuthentication',) } +REST_KNOX = { + 'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA3_512', + 'TOKEN_TTL': timedelta(hours=10), +} + MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', @@ -234,4 +240,4 @@ # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static') \ No newline at end of file +STATIC_ROOT = os.path.join(BASE_DIR, 'static')