Initial V2 commit 4

This commit is contained in:
Hamza-Ayed
2026-04-22 23:16:23 +03:00
parent 3269a836a2
commit 3f4afd0f5c
47 changed files with 456 additions and 72 deletions

View File

@@ -9,10 +9,16 @@ use Firebase\JWT\Key;
use Firebase\JWT\ExpiredException;
/**
* JWT Authentication Middleware
* وسيط التحقق من الهوية (JWT Authentication Middleware)
*
* Validates JWT tokens from the Authorization header.
* Works in conjunction with HMAC middleware for double-layer security.
* الغرض من الملف:
* التحقق من "رمز الوصول" (Access Token) الذي يحمله المستخدم بعد تسجيل الدخول للتأكد من هويته.
*
* كيفية العمل:
* 1. يستخرج الرمز من رأس الطلب (Authorization Header).
* 2. يقوم بفك تشفير الرمز (Decode) باستخدام مفتاح سري (JWT Secret).
* 3. يستخرج بيانات المستخدم (مثل المعرف والنوع) ويضيفها للطلب ليسهل الوصول إليها في المتحكمات.
* 4. يمنع الطلب إذا كان الرمز منتهي الصلاحية أو غير صحيح.
*/
class JwtAuthMiddleware
{