Inheritance: extends SAML2\Configuration\Queryable
 public function canValidate(SignedElement $signedElement, CertificateProvider $configuration)
 {
     if ($configuration->getCertificateFingerprints() === null) {
         $this->logger->debug('Configuration does not have "certFingerprint" value, cannot validate signature with fingerprint');
         return false;
     }
     // use internal cache to prevent doing certificate extraction twice.
     $this->certificates = $signedElement->getCertificates();
     if (empty($this->certificates)) {
         $this->logger->debug('Signed element does not have certificates, cannot validate signature with fingerprint');
         return false;
     }
     return true;
 }
示例#2
0
 /**
  * Loads the fingerprints from a configurationValue
  *
  * @param \SAML2\Configuration\CertificateProvider $configuration
  *
  * @return \SAML2\Certificate\FingerprintCollection
  *
  * @deprecated
  */
 public function loadFingerprints(CertificateProvider $configuration)
 {
     $fingerprints = $configuration->getCertificateFingerprints();
     if (!is_array($fingerprints) && !$fingerprints instanceof \Traversable) {
         throw InvalidArgumentException::invalidType('array or instanceof \\Traversable', $fingerprints);
     }
     $collection = new FingerprintCollection();
     foreach ($fingerprints as $fingerprint) {
         if (!is_string($fingerprint) && !(is_object($fingerprint) && method_exists($fingerprint, '__toString'))) {
             throw InvalidArgumentException::invalidType('fingerprint as string or object that can be casted to string', $fingerprint);
         }
         $collection->add(new Fingerprint((string) $fingerprint));
     }
     return $collection;
 }
示例#3
0
 /**
  * @param \SAML2\Configuration\CertificateProvider $config
  * @param null|string                             $usage
  * @param bool                                    $required
  *
  * @return \SAML2\Certificate\KeyCollection
  */
 public function loadKeysFromConfiguration(CertificateProvider $config, $usage = null, $required = false)
 {
     $keys = $config->getKeys();
     $certificateData = $config->getCertificateData();
     $certificateFile = $config->getCertificateFile();
     if ($keys) {
         $this->loadKeys($keys, $usage);
     } elseif ($certificateData) {
         $this->loadCertificateData($certificateData);
     } elseif ($certificateFile) {
         $this->loadCertificateFile($certificateFile);
     }
     if ($required && !$this->hasKeys()) {
         throw new NoKeysFoundException('No keys found in configured metadata, please ensure that either the "keys", "certData" or ' . '"certificate" entries is available.');
     }
     return $this->getKeys();
 }