ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ValidatorChain.php
Go to the documentation of this file.
1<?php
2
3namespace SAML2\Signature;
4
8
16{
20 private $logger;
21
25 private $validators = array();
26
32 {
33 $this->logger = $logger;
34
35 // should be done through "adder" injection in the container.
36 foreach ($validators as $validator) {
37 $this->appendValidator($validator);
38 }
39 }
40
44 public function appendValidator(ChainedValidator $validator)
45 {
46 $this->validators[] = $validator;
47 }
48
55 public function hasValidSignature(
56 SignedElement $signedElement,
57 CertificateProvider $configuration
58 ) {
59 foreach ($this->validators as $validator) {
60 if ($validator->canValidate($signedElement, $configuration)) {
61 $this->logger->debug(sprintf(
62 'Validating the signed element with validator of type "%s"',
63 get_class($validator)
64 ));
65
66 return $validator->hasValidSignature($signedElement, $configuration);
67 }
68
69 $this->logger->debug(sprintf(
70 'Could not validate the signed element with validator of type "%s"',
71 get_class($validator)
72 ));
73 }
74
75 throw new MissingConfigurationException(sprintf(
76 'No certificates or fingerprints have been configured%s',
77 $configuration->has('entityid') ? ' for "' . $configuration->get('entityid') . '"' : ''
78 ));
79 }
80}
An exception for terminatinating execution or to throw for unit testing.
Allows for validation of a signature trying different validators till a validator is found that can v...
appendValidator(ChainedValidator $validator)
hasValidSignature(SignedElement $signedElement, CertificateProvider $configuration)
__construct(LoggerInterface $logger, array $validators)
Describes a logger instance.
has($key)
Query for whether or not the configuration has a value for the key.
get($key, $default=null)
Query to get the value in the configuration for the given key.
Interface \SAML2\Validator\Responsible.