🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 15:11

This commit is contained in:
Hamza-Ayed
2026-05-03 15:11:34 +03:00
parent 3aeb3220f1
commit 7cd2d91576
23 changed files with 1418 additions and 879 deletions

View File

@@ -25,6 +25,22 @@ final class AuthMiddleware
try {
$decoded = $this->jwtService->verifyToken($token);
// Check if JTI is blacklisted
$jti = $decoded['jti'] ?? null;
if ($jti) {
try {
$redis = \App\Core\Redis::getInstance();
if ($redis->exists('jwt_blacklist:' . $jti)) {
Response::error('الجلسة منتهية، يرجى تسجيل الدخول من جديد', 'TOKEN_REVOKED', 401);
return null;
}
} catch (\Throwable $e) {
// Redis down — allow (fail open, log security event)
error_log('[AUTH] JWT blacklist check failed: ' . $e->getMessage());
}
}
$request->user = (object) $decoded;
$request->tenantId = $decoded['tenant_id'] ?? null;
} catch (Exception $e) {