forked from laysense/laysite
Load site settings from dotenv and store OAuth credentials
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Config\Environment;
|
||||
use App\Content\BlockTemplates;
|
||||
use App\Content\Database;
|
||||
use App\Content\DesignLibrary;
|
||||
@@ -26,7 +27,7 @@ final class McpController
|
||||
if ($origin !== null && $origin !== '' && $origin !== rtrim(View::absolute(''), '/')) {
|
||||
return new Response(403, ['Cache-Control' => 'no-store']);
|
||||
}
|
||||
$secret = getenv('LAYSITE_MCP_TOKEN');
|
||||
$secret = Environment::get('LAYSITE_MCP_TOKEN');
|
||||
$header = $request->header('authorization', '');
|
||||
if (!is_string($secret) || strlen($secret) < 32 || !is_string($header) || !hash_equals('Bearer ' . $secret, $header)) {
|
||||
return new Response(401, ['WWW-Authenticate' => 'Bearer realm="LaySite MCP"', 'Cache-Control' => 'no-store']);
|
||||
|
||||
Reference in New Issue
Block a user