integraçao site

This commit is contained in:
HalbeBruno
2025-12-17 12:33:42 -03:00
parent fca10b13c1
commit 72b7d8ccd7
572 changed files with 1646 additions and 27 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Middleware;
use App\Utils\View;
class IntegrationMiddleware
{
public function handle()
{
$headers = getallheaders();
$tokenHeader = $headers['X-Integration-Token'] ?? $headers['x-integration-token'] ?? $_SERVER['HTTP_X_INTEGRATION_TOKEN'] ?? '';
$validToken = $_ENV['INTEGRATION_TOKEN'] ?? null;
if (empty($validToken) || $tokenHeader !== $validToken) {
View::json(['error' => 'Unauthorized'], 401);
return false;
}
return true;
}
}