diff --git a/src/Controllers/AwsSnsController.php b/src/Controllers/AwsSnsController.php index c9cf9bc..9561d0c 100644 --- a/src/Controllers/AwsSnsController.php +++ b/src/Controllers/AwsSnsController.php @@ -5,6 +5,7 @@ use Aws\Sns\Exception\InvalidSnsMessageException; use Aws\Sns\Message; use Aws\Sns\MessageValidator; +use Illuminate\Support\Facades\Cache; use JoggApp\AwsSns\Events\SnsMessageReceived; use JoggApp\AwsSns\Events\SnsTopicSubscriptionConfirmed; @@ -14,7 +15,11 @@ public function __invoke() { $message = Message::fromRawPostData(); - $validator = new MessageValidator(); + $validator = new MessageValidator(function ($certUrl) { + return Cache::rememberForever($certUrl, function () use ($certUrl) { + return file_get_contents($certUrl); + }); + }); try { $validator->validate($message);