Deprecation: Please load full certificates instead.
Exemplo n.º 1
0
 /**
  * @group        certificate
  * @test
  *
  * @dataProvider invalidConfigurationProvider
  * @expectedException \SAML2\Exception\InvalidArgumentException
  */
 public function it_correctly_parses_arrays_and_traversables($configurationValue)
 {
     $this->configurationMock->shouldReceive('getCertificateFingerprints')->once()->andReturn($configurationValue);
     $result = $this->fingerprintLoader->loadFingerprints($this->configurationMock);
     $this->assertInstanceOf('\\SAML2\\Certificate\\FingerprintCollection', $result);
     $this->assertCount(count($configurationValue), $result);
 }
Exemplo n.º 2
0
 /**
  * @param \SAML2\SignedElement             $signedElement
  * @param \SAML2\Configuration\CertificateProvider $configuration
  *
  * @return bool
  */
 public function hasValidSignature(SignedElement $signedElement, CertificateProvider $configuration)
 {
     $this->certificates = array_map(function ($certificate) {
         return X509::createFromCertificateData($certificate);
     }, $this->certificates);
     $fingerprintCollection = $this->fingerprintLoader->loadFromConfiguration($configuration);
     $pemCandidates = array();
     foreach ($this->certificates as $certificate) {
         /** @var \SAML2\Certificate\X509 $certificate */
         $certificateFingerprint = $certificate->getFingerprint();
         if ($fingerprintCollection->contains($certificateFingerprint)) {
             $pemCandidates[] = $certificate;
         }
     }
     if (empty($pemCandidates)) {
         $this->logger->debug('Unable to match a certificate of the SignedElement matching a configured fingerprint');
         return false;
     }
     return $this->validateElementWithKeys($signedElement, $pemCandidates);
 }