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

Public Member Functions

 __construct (LoggerInterface $logger)
 
- Public Member Functions inherited from SAML2\Signature\ChainedValidator
 canValidate (SignedElement $signedElement, CertificateProvider $configuration)
 Test whether or not this link in the chain can validate the signedElement signature. More...
 
- Public Member Functions inherited from SAML2\Signature\ValidatorInterface
 hasValidSignature (SignedElement $signedElement, CertificateProvider $configuration)
 Validate the signature of the signed Element based on the configuration. More...
 

Protected Member Functions

 validateElementWithKeys (SignedElement $element, $pemCandidates)
 BC compatible version of the signature check. More...
 

Protected Attributes

 $logger
 

Detailed Description

Definition at line 9 of file AbstractChainedValidator.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\Signature\AbstractChainedValidator::__construct ( LoggerInterface  $logger)

Member Function Documentation

◆ validateElementWithKeys()

SAML2\Signature\AbstractChainedValidator::validateElementWithKeys ( SignedElement  $element,
  $pemCandidates 
)
protected

BC compatible version of the signature check.

Parameters
\SAML2\SignedElement$element
\SAML2\Certificate\X509[]$pemCandidates
Exceptions

Exception

Returns
bool

Definition at line 31 of file AbstractChainedValidator.php.

32 {
33 $lastException = null;
34 foreach ($pemCandidates as $index => $candidateKey) {
35 $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type' => 'public'));
36 $key->loadKey($candidateKey->getCertificate());
37
38 try {
39 /*
40 * Make sure that we have a valid signature on either the response or the assertion.
41 */
42 $result = $element->validate($key);
43 if ($result) {
44 $this->logger->debug(sprintf('Validation with key "#%d" succeeded', $index));
45 return true;
46 }
47 $this->logger->debug(sprintf('Validation with key "#%d" failed without exception.', $index));
48 } catch (\Exception $e) {
49 $this->logger->debug(sprintf(
50 'Validation with key "#%d" failed with exception: %s',
51 $index,
52 $e->getMessage()
53 ));
54
55 $lastException = $e;
56 }
57 }
58
59 if ($lastException !== null) {
60 throw $lastException;
61 } else {
62 return false;
63 }
64 }
$result
$key
Definition: croninfo.php:18
$index
Definition: metadata.php:60

References $index, $key, $result, RobRichards\XMLSecLibs\XMLSecurityKey\RSA_SHA256, and SAML2\SignedElement\validate().

Referenced by SAML2\Signature\PublicKeyValidator\hasValidSignature().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $logger


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