feat: implement JWT-based authentication system with repository, service, and middleware layers

This commit is contained in:
2026-09-09 20:02:55 -03:00
parent f6d7d42f10
commit 14b85d28a1
11 changed files with 975 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace WorkbloomERP\Security;
class AuthContext {
private static ?array $user = null;
public static function setUser(array $user): void {
self::$user = $user;
}
public static function getUser(): ?array {
return self::$user;
}
public static function getUserId(): ?int {
return isset(self::$user['id']) ? (int)self::$user['id'] : null;
}
public static function getUserUuid(): ?string {
return self::$user['sub'] ?? self::$user['uuid'] ?? null;
}
public static function clear(): void {
self::$user = null;
}
}