Skip to content

Commit

Permalink
API Key Creation & Management
Browse files Browse the repository at this point in the history
Added functionality for superusers and users to create and manage API keys, with Knox integration for secure key hashing.
  • Loading branch information
NEZRI Ygal authored and NEZRI Ygal committed Jul 19, 2024
1 parent ab31d61 commit b67005c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Watcher/Watcher/watcher/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', "")
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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')
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

0 comments on commit b67005c

Please sign in to comment.