ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSimpleSAMLphplIdpDiscovery.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
7 class ilSimpleSAMLphplIdpDiscovery extends SimpleSAML\XHTML\IdPDisco implements ilSamlIdpDiscovery
8 {
9  const METADATA_DIRECTORY = 'auth/saml/metadata';
10 
14  public function __construct()
15  {
16  $this->config = SimpleSAML\Configuration::getInstance();
17  $this->metadata = SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
18  $this->instance = 'saml';
19  $this->metadataSets = ['saml20-idp-remote'];
20  $this->isPassive = false;
21  }
22 
26  public function getMetadataDirectory() : string
27  {
28  return self::METADATA_DIRECTORY;
29  }
30 
34  public function getList() : array
35  {
36  return $this->getIdPList();
37  }
38 
43  private function getMetadataPath(int $idpId) : string
44  {
45  return $this->getMetadataDirectory() . '/' . $idpId . '.xml';
46  }
47 
51  public function storeIdpMetadata(int $idpId, string $metadata) : void
52  {
53  global $DIC;
54 
55  $fs = $DIC->filesystem()->storage();
56 
57  $fs->put($this->getMetadataPath($idpId), $metadata);
58  }
59 
63  public function fetchIdpMetadata(int $idpId) : string
64  {
65  global $DIC;
66 
67  $fs = $DIC->filesystem()->storage();
68 
69  if (!$fs->has($this->getMetadataPath($idpId))) {
70  return '';
71  }
72 
73  return $fs->read($this->getMetadataPath($idpId));
74  }
75 
79  public function deleteIdpMetadata(int $idpId) : void
80  {
81  global $DIC;
82 
83  $fs = $DIC->filesystem()->storage();
84 
85  if ($fs->has($this->getMetadataPath($idpId))) {
86  $fs->delete($this->getMetadataPath($idpId));
87  }
88  }
89 }
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.
$DIC
Definition: xapitoken.php:46
Class ilSimpleSAMLphplIdpDiscovery.