ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
FingerprintLoader.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\Certificate;
4 
7 
12 {
22  public static function loadFromConfiguration(CertificateProvider $configuration)
23  {
24  $loader = new self();
25 
26  return $loader->loadFingerprints($configuration);
27  }
28 
38  public function loadFingerprints(CertificateProvider $configuration)
39  {
40  $fingerprints = $configuration->getCertificateFingerprints();
41  if (!is_array($fingerprints) && !$fingerprints instanceof \Traversable) {
43  'array or instanceof \Traversable',
44  $fingerprints
45  );
46  }
47 
48  $collection = new FingerprintCollection();
49  foreach ($fingerprints as $fingerprint) {
50  if (!is_string($fingerprint) && !(is_object($fingerprint) && method_exists($fingerprint, '__toString'))) {
52  'fingerprint as string or object that can be casted to string',
53  $fingerprint
54  );
55  }
56 
57  $collection->add(new Fingerprint((string) $fingerprint));
58  }
59 
60  return $collection;
61  }
62 }
CertificateProvider interface.
static loadFromConfiguration(CertificateProvider $configuration)
Static method mainly for BC, should be replaced with DI.
loadFingerprints(CertificateProvider $configuration)
Loads the fingerprints from a configurationValue.
getCertificateFingerprints()
Returns an array or where each element represents a certificate fingerprint.
Simple collection object for transporting keys.
Simple representation of the fingerprint of a certificate.
Definition: Fingerprint.php:12