ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SAML2\Signature\PublicKeyValidator Class Reference
+ Inheritance diagram for SAML2\Signature\PublicKeyValidator:
+ Collaboration diagram for SAML2\Signature\PublicKeyValidator:

Public Member Functions

 __construct (LoggerInterface $logger, KeyLoader $keyLoader)
 
 canValidate (SignedElement $signedElement, CertificateProvider $configuration)
 
 hasValidSignature (SignedElement $signedElement, CertificateProvider $configuration)
 
- Public Member Functions inherited from SAML2\Signature\AbstractChainedValidator
 __construct (LoggerInterface $logger)
 

Private Attributes

 $configuredKeys
 
 $keyLoader
 

Additional Inherited Members

- Protected Member Functions inherited from SAML2\Signature\AbstractChainedValidator
 validateElementWithKeys (SignedElement $element, $pemCandidates)
 BC compatible version of the signature check. More...
 
- Protected Attributes inherited from SAML2\Signature\AbstractChainedValidator
 $logger
 

Detailed Description

Definition at line 12 of file PublicKeyValidator.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\Signature\PublicKeyValidator::__construct ( LoggerInterface  $logger,
KeyLoader  $keyLoader 
)

Definition at line 24 of file PublicKeyValidator.php.

References SAML2\Signature\PublicKeyValidator\$keyLoader.

25  {
26  $this->keyLoader = $keyLoader;
27 
28  parent::__construct($logger);
29  }

Member Function Documentation

◆ canValidate()

SAML2\Signature\PublicKeyValidator::canValidate ( SignedElement  $signedElement,
CertificateProvider  $configuration 
)
Parameters
\SAML2\SignedElement$signedElement
\SAML2\Configuration\CertificateProvider$configuration
Returns
bool

Implements SAML2\Signature\ChainedValidator.

Definition at line 37 of file PublicKeyValidator.php.

40  {
41  $this->configuredKeys = $this->keyLoader->extractPublicKeys($configuration);
42 
43  return !!count($this->configuredKeys);
44  }

◆ hasValidSignature()

SAML2\Signature\PublicKeyValidator::hasValidSignature ( SignedElement  $signedElement,
CertificateProvider  $configuration 
)
Parameters
\SAML2\SignedElement$signedElement
\SAML2\Configuration\CertificateProvider$configuration
Returns
bool

Implements SAML2\Signature\ValidatorInterface.

Definition at line 52 of file PublicKeyValidator.php.

References $key, SAML2\Signature\AbstractChainedValidator\$logger, and SAML2\Signature\AbstractChainedValidator\validateElementWithKeys().

55  {
57  $pemCandidates = $this->configuredKeys->filter(function (Key $key) use ($logger) {
58  if (!$key instanceof X509) {
59  $logger->debug(sprintf('Skipping unknown key type: "%s"', $key['type']));
60  return false;
61  }
62  return true;
63  });
64 
65  if (!count($pemCandidates)) {
66  $this->logger->debug('No configured X509 certificate found to verify the signature with');
67 
68  return false;
69  }
70 
71  return $this->validateElementWithKeys($signedElement, $pemCandidates);
72  }
validateElementWithKeys(SignedElement $element, $pemCandidates)
BC compatible version of the signature check.
Pure-PHP X.509 Parser.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

Field Documentation

◆ $configuredKeys

SAML2\Signature\PublicKeyValidator::$configuredKeys
private

Definition at line 17 of file PublicKeyValidator.php.

◆ $keyLoader

SAML2\Signature\PublicKeyValidator::$keyLoader
private

The documentation for this class was generated from the following file: