ILIAS  release_8 Revision v8.23
class.ilSimpleSAMLphplIdpDiscovery.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 class ilSimpleSAMLphplIdpDiscovery extends SimpleSAML\XHTML\IdPDisco implements ilSamlIdpDiscovery
26 {
27  private const METADATA_DIRECTORY = 'auth/saml/metadata';
28 
32  public function __construct()
33  {
34  $this->config = SimpleSAML\Configuration::getInstance();
35  $this->metadata = SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
36  $this->instance = 'saml';
37  $this->metadataSets = ['saml20-idp-remote'];
38  $this->isPassive = false;
39  }
40 
44  public function getMetadataDirectory(): string
45  {
46  return self::METADATA_DIRECTORY;
47  }
48 
52  public function getList(): array
53  {
54  return $this->getIdPList();
55  }
56 
61  private function getMetadataPath(int $idpId): string
62  {
63  return $this->getMetadataDirectory() . '/' . $idpId . '.xml';
64  }
65 
69  public function storeIdpMetadata(int $idpId, string $metadata): void
70  {
71  global $DIC;
72 
73  $fs = $DIC->filesystem()->storage();
74 
75  $fs->put($this->getMetadataPath($idpId), $metadata);
76  }
77 
81  public function fetchIdpMetadata(int $idpId): string
82  {
83  global $DIC;
84 
85  $fs = $DIC->filesystem()->storage();
86 
87  if (!$fs->has($this->getMetadataPath($idpId))) {
88  return '';
89  }
90 
91  return $fs->read($this->getMetadataPath($idpId));
92  }
93 
97  public function deleteIdpMetadata(int $idpId): void
98  {
99  global $DIC;
100 
101  $fs = $DIC->filesystem()->storage();
102 
103  if ($fs->has($this->getMetadataPath($idpId))) {
104  $fs->delete($this->getMetadataPath($idpId));
105  }
106  }
107 }
global $DIC
Definition: feed.php:28
getList()
This method should return an array of IDPs.Each element should be an array as well, providing at least a value for key &#39;entityid&#39;. array
storeIdpMetadata(int $idpId, string $metadata)
__construct()
ilSimpleSAMLphplIdpDiscovery constructor.
Class ilSimpleSAMLphplIdpDiscovery.