feat: update auth logic

This commit is contained in:
2026-06-09 19:37:32 +03:00
parent e1f074b94d
commit 6c3628edfa
12 changed files with 40 additions and 189 deletions

View File

@@ -23,8 +23,7 @@ class JwtService(IJwtService):
return AccessTokenPayload(
sub=str(payload['sub']),
type='access',
sid=str(payload['sid']) if payload.get('sid') else None,
role=str(payload['role']) if payload.get('role') else None,
sid=str(payload['sid']),
iat=int(payload['iat']),
nbf=int(payload['nbf']),
exp=int(payload['exp']),
@@ -84,9 +83,9 @@ class JwtService(IJwtService):
options=options,
)
if 'sid' not in payload and 'role' not in payload:
self._logger.warning(f'JWT missing sid or role claim kid={kid}')
raise ApplicationException(status_code=401, message='Missing token claim: sid or role')
if 'sid' not in payload:
self._logger.warning(f'JWT missing sid claim kid={kid}')
raise ApplicationException(status_code=401, message='Missing token claim: sid')
if 'type' not in payload:
self._logger.warning(f'JWT missing type claim kid={kid}')