zarbox added 7

This commit is contained in:
2026-06-04 17:39:06 +03:30
parent bdafca0f1d
commit a9f468c51b
7 changed files with 87 additions and 9 deletions
+9 -7
View File
@@ -2,10 +2,10 @@
namespace App\Http\Middleware;
use App\Services\ConfigService;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
class ValidateRequests
{
@@ -21,14 +21,16 @@ class ValidateRequests
abort(401, 'Missing HMAC headers');
}
if ($clientId !== config('services.node.client_id')) {
abort(401, 'Invalid client id');
$config = app(ConfigService::class);
$expectedClientId = $config->nodeClientId();
$secret = $config->nodeSharedSecret();
if ($expectedClientId === '' || $secret === '') {
abort(500, 'Node API credentials not configured (settings: node_client_id, node_shared_secret)');
}
/** ✅ اینجا SECRET واقعاً استفاده می‌شود */
$secret = config('services.node.secret');
if (!$secret) {
abort(500, 'Node shared secret not configured');
if ($clientId !== $expectedClientId) {
abort(401, 'Invalid client id');
}