zarbox added 7
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user