/** * @param Notification $notification * @throws InvalidNotificationException * @return void */ public function validate(Notification $notification) { $certificateList = $this->client->certificateGet($notification->getIssuer()); if (0 == count($certificateList->getCertificates())) { throw new InvalidNotificationException(sprintf("Issuer '%s' has no Appsco certificates", $notification->getIssuer())); } $error = null; foreach ($certificateList->getCertificates() as $certificate) { try { $this->jwtEncoder->verify($notification, $certificate->getCertificate()); $error = null; break; } catch (\Exception $ex) { $error = $ex; } } if ($error) { throw new InvalidNotificationException(sprintf("Unable to verify certificate of issuer '%s'", $notification->getIssuer()), 0, $error); } }
/** * @param Notification $notification * @throws InvalidNotificationException * @return void */ public function validate(Notification $notification) { if (false == array_key_exists($notification->getIssuer(), $this->validIssuers)) { throw new InvalidNotificationException(sprintf("Invalid issuer '%s'", $notification->getIssuer())); } }