Adding LDAP support
This commit is contained in:
1 parent
d60ad42f0c
commit
f2b99089ea
17 files changed
+541
-23
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""Password hashing and JWT token helpers."""
|
||||
|
||||
import hashlib
|
||||
import secrets
|
||||
import uuid
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
@@ -27,6 +28,16 @@ def verify_password(password: str, hashed: str) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def make_unusable_password() -> str:
|
||||
"""A sentinel hash that no password can match.
|
||||
|
||||
Used for externally-authenticated users (e.g. LDAP) who have no local
|
||||
password. It is not a valid bcrypt hash, so ``verify_password`` always
|
||||
returns ``False`` for it — local password auth can never succeed.
|
||||
"""
|
||||
return "!" + secrets.token_urlsafe(32)
|
||||
|
||||
|
||||
# --- JWT ---------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user