ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSimpleSAMLphplIdpDiscovery.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21final class ilSimpleSAMLphplIdpDiscovery extends SimpleSAML\XHTML\IdPDisco implements ilSamlIdpDiscovery
22{
23 private const string METADATA_DIRECTORY = 'auth/saml/metadata';
24
25 public function __construct()
26 {
27 $this->config = SimpleSAML\Configuration::getInstance();
28 $this->metadata = SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
29 $this->instance = 'saml';
30 $this->metadataSets = ['saml20-idp-remote'];
31 $this->isPassive = false;
32 }
33
34 public function getMetadataDirectory(): string
35 {
37 }
38
39 public function getList(): array
40 {
41 return $this->getIdPList();
42 }
43
44 private function getMetadataPath(int $idpId): string
45 {
46 return $this->getMetadataDirectory() . '/' . $idpId . '.xml';
47 }
48
49 public function storeIdpMetadata(int $idpId, string $metadata): void
50 {
51 global $DIC;
52
53 $fs = $DIC->filesystem()->storage();
54
55 $fs->put($this->getMetadataPath($idpId), $metadata);
56 }
57
58 public function fetchIdpMetadata(int $idpId): string
59 {
60 global $DIC;
61
62 $fs = $DIC->filesystem()->storage();
63
64 if (!$fs->has($this->getMetadataPath($idpId))) {
65 return '';
66 }
67
68 return $fs->read($this->getMetadataPath($idpId));
69 }
70
71 public function deleteIdpMetadata(int $idpId): void
72 {
73 global $DIC;
74
75 $fs = $DIC->filesystem()->storage();
76
77 if ($fs->has($this->getMetadataPath($idpId))) {
78 $fs->delete($this->getMetadataPath($idpId));
79 }
80 }
81}
storeIdpMetadata(int $idpId, string $metadata)
getList()
This method should return an array of IDPs.
global $DIC
Definition: shib_login.php:26