43 assert(
'is_array($config)');
49 if (array_key_exists(
'directory',
$config)) {
50 $this->directory =
$config[
'directory'];
52 $this->directory =
$globalConfig->getString(
'metadatadir',
'metadata/');
58 $this->directory =
$globalConfig->resolvePath($this->directory).
'/';
72 private function load($set)
74 $metadatasetfile = $this->directory.$set.
'.php';
76 if (!file_exists($metadatasetfile)) {
82 include($metadatasetfile);
85 throw new Exception(
'Could not load metadata set ['.$set.
'] from file: '.$metadatasetfile);
103 if (array_key_exists($set, $this->cachedMetadata)) {
104 return $this->cachedMetadata[$set];
107 $metadataSet = $this->
load($set);
108 if ($metadataSet === null) {
109 $metadataSet =
array();
113 foreach ($metadataSet as
$entityId => &$entry) {
114 if (preg_match(
'/__DYNAMIC(:[0-9]+)?__/',
$entityId)) {
121 $this->cachedMetadata[$set] = $metadataSet;
132 if ($set ===
'saml20-idp-hosted') {
133 return $baseurl.
'saml2/idp/metadata.php';
134 } elseif ($set ===
'shib13-idp-hosted') {
135 return $baseurl.
'shib13/idp/metadata.php';
136 } elseif ($set ===
'wsfed-sp-hosted') {
137 return 'urn:federation:'.\SimpleSAML\Utils\HTTP::getSelfHost();
138 } elseif ($set ===
'adfs-idp-hosted') {
139 return 'urn:federation:'.\SimpleSAML\Utils\HTTP::getSelfHost().
':idp';
141 throw new Exception(
'Can not generate dynamic EntityID for metadata of this type: ['.$set.
']');
$metadata['__DYNAMIC:1__']
Create styles array
The data for the language used.
static getBaseURL()
Retrieve the base URL of the SimpleSAMLphp installation.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.