ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSimpleSAMLphplIdpDiscovery.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Saml/interfaces/interface.ilSamlIdpDiscovery.php';
5 
10 {
11  const METADATA_DIRECTORY = 'auth/saml/metadata';
12 
16  public function __construct()
17  {
18  $this->config = SimpleSAML_Configuration::getInstance();
20  $this->instance = 'saml';
21  $this->metadataSets = array('saml20-idp-remote');
22  $this->isPassive = false;
23  }
24 
28  public function getMetadataDirectory()
29  {
30  return self::METADATA_DIRECTORY;
31  }
32 
36  public function getList()
37  {
38  return $this->getIdPList();
39  }
40 
45  protected function getMetadataPath($idpId)
46  {
47  return $this->getMetadataDirectory() . '/' . $idpId . '.xml';
48  }
49 
53  public function storeIdpMetadata($idpId, $metadata)
54  {
55  global $DIC;
56 
57  $fs = $DIC->filesystem()->storage();
58 
59  $fs->put($this->getMetadataPath($idpId), $metadata);
60  }
61 
65  public function fetchIdpMetadata($idpId)
66  {
67  global $DIC;
68 
69  $fs = $DIC->filesystem()->storage();
70 
71  if (!$fs->has($this->getMetadataPath($idpId))) {
72  return '';
73  }
74 
75  return $fs->read($this->getMetadataPath($idpId));
76  }
77 
81  public function deleteIdpMetadata($idpId)
82  {
83  global $DIC;
84 
85  $fs = $DIC->filesystem()->storage();
86 
87  if ($fs->has($this->getMetadataPath($idpId))) {
88  $fs->delete($this->getMetadataPath($idpId));
89  }
90  }
91 }
static getMetadataHandler()
This function retrieves the current instance of the metadata handler.
global $DIC
Definition: saml.php:7
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
getIdPList()
Retrieve the list of IdPs which are stored in the metadata.
Definition: IdPDisco.php:459
instance(Loop $newLoop=null)
Retrieves or sets the global Loop object.
Definition: functions.php:173
__construct()
ilSimpleSAMLphplIdpDiscovery constructor.
Class ilSimpleSAMLphplIdpDiscovery.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.