fix: stabilize auth tests and mailu service
This commit is contained in:
parent
1bed2d9294
commit
248177dedd
@ -30,11 +30,11 @@ class KeycloakOIDC:
|
||||
def verify(self, token: str) -> dict[str, Any]:
|
||||
if not token:
|
||||
raise ValueError("missing token")
|
||||
jwks = self._get_jwks()
|
||||
header = jwt.get_unverified_header(token)
|
||||
kid = header.get("kid")
|
||||
if not isinstance(kid, str):
|
||||
raise ValueError("token missing kid")
|
||||
jwks = self._get_jwks()
|
||||
key = None
|
||||
for candidate in jwks.get("keys", []) if isinstance(jwks, dict) else []:
|
||||
if isinstance(candidate, dict) and candidate.get("kid") == kid:
|
||||
|
||||
@ -61,3 +61,6 @@ class MailuService:
|
||||
if isinstance(raw, str) and raw.strip():
|
||||
return raw.strip()
|
||||
return f"{username}@{settings.mailu_domain}"
|
||||
|
||||
|
||||
mailu = MailuService()
|
||||
|
||||
2
pytest.ini
Normal file
2
pytest.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
pythonpath = .
|
||||
@ -1,7 +1,7 @@
|
||||
fastapi==0.115.11
|
||||
uvicorn[standard]==0.30.6
|
||||
httpx==0.27.2
|
||||
PyJWT==2.10.1
|
||||
PyJWT[crypto]==2.10.1
|
||||
psycopg[binary]==3.2.6
|
||||
psycopg-pool==3.2.6
|
||||
croniter==2.0.7
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user