Switch to cognito user/password authentication. Major code refactor.
Some checks failed
AWS Deploy on Push / build (push) Failing after 48s

This commit is contained in:
2025-05-16 11:05:54 -05:00
parent 8d1997fa5a
commit c221a8cded
17 changed files with 220 additions and 109 deletions

12
app/utils/auth.py Normal file
View File

@@ -0,0 +1,12 @@
import base64
import hashlib
import hmac
def calculate_secret_hash(username: str, client_id: str, client_secret: str) -> str:
"""
Calculate the Cognito SECRET_HASH using HMAC SHA256 for secret-enabled clients.
"""
msg = username + client_id
dig = hmac.new(client_secret.encode('utf-8'),
msg.encode('utf-8'), hashlib.sha256).digest()
return base64.b64encode(dig).decode()