test: expired JWT shows empty role in logs

This commit is contained in:
steve-chavez
2026-05-05 19:29:59 -05:00
committed by Steve Chavez
parent e39740cca3
commit 8105375b64
3 changed files with 26 additions and 5 deletions
+5
View File
@@ -1,5 +1,6 @@
import threading
import jwt
from datetime import datetime, timedelta, timezone
class Thread(threading.Thread):
@@ -31,6 +32,10 @@ def jwtauthheader(claim, secret):
return authheader(jwt.encode(claim, secret))
def relativeSeconds(sec):
return int((datetime.now(timezone.utc) + timedelta(seconds=sec)).timestamp())
def parse_server_timings_header(header):
"""Parse the Server-Timing header into a dict of metric names to values.