admin 13
This commit is contained in:
@@ -134,9 +134,9 @@ class JwtService
|
||||
self::abort(401, 'Invalid token');
|
||||
}
|
||||
|
||||
// 3. Issuer
|
||||
if (($decoded->iss ?? '') !== $this->issuer) {
|
||||
self::abort(401, 'Invalid token issuer');
|
||||
// 3. Issuer (Only check if configured)
|
||||
if (!empty($this->issuer) && ($decoded->iss ?? '') !== $this->issuer) {
|
||||
self::abort(401, 'Invalid token issuer: expected ' . $this->issuer . ' but got ' . ($decoded->iss ?? 'none'));
|
||||
}
|
||||
|
||||
// 4. User ID
|
||||
@@ -232,6 +232,7 @@ class JwtService
|
||||
|
||||
private static function abort(int $code, string $message): never
|
||||
{
|
||||
error_log("[JWT_AUTH_FAILED] Code: $code | Message: $message | IP: " . ($_SERVER['REMOTE_ADDR'] ?? '?') . " | URI: " . ($_SERVER['REQUEST_URI'] ?? '?'));
|
||||
http_response_code($code);
|
||||
echo json_encode(['error' => $message]);
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user