42 if (self::$metadataHandler === null) {
46 return self::$metadataHandler;
58 $sourcesConfig =
$config->getArray(
'metadata.sources', null);
61 if ($sourcesConfig === null) {
62 $type =
$config->getString(
'metadata.handler',
'flatfile');
63 $sourcesConfig = array(array(
'type' =>
$type));
70 "Invalid configuration of the 'metadata.sources' configuration option: ".$e->getMessage()
90 if (array_key_exists($property, $metadataSet)) {
91 return $metadataSet[$property];
101 $baseurl = \SimpleSAML\Utils\HTTP::getSelfURLHost().$config->getBasePath();
103 if ($set ==
'saml20-sp-hosted') {
104 if ($property ===
'SingleLogoutServiceBinding') {
105 return \SAML2\Constants::BINDING_HTTP_REDIRECT;
107 } elseif ($set ==
'saml20-idp-hosted') {
109 case 'SingleSignOnService':
110 return $baseurl.
'saml2/idp/SSOService.php';
112 case 'SingleSignOnServiceBinding':
113 return \SAML2\Constants::BINDING_HTTP_REDIRECT;
115 case 'SingleLogoutService':
116 return $baseurl.
'saml2/idp/SingleLogoutService.php';
118 case 'SingleLogoutServiceBinding':
119 return \SAML2\Constants::BINDING_HTTP_REDIRECT;
121 } elseif ($set ==
'shib13-idp-hosted') {
122 if ($property ===
'SingleSignOnService') {
123 return $baseurl.
'shib13/idp/SSOService.php';
127 throw new Exception(
'Could not generate metadata property '.$property.
' for set '.$set.
'.');
139 public function getList($set =
'saml20-idp-remote')
141 assert(is_string($set));
145 foreach ($this->sources as
$source) {
146 $srcList = $source->getMetadataSet($set);
148 foreach ($srcList as
$key => $le) {
149 if (array_key_exists(
'expire', $le)) {
150 if ($le[
'expire'] < time()) {
151 unset($srcList[
$key]);
153 "Dropping metadata entity ".var_export($key,
true).
", expired ".
154 SimpleSAML\Utils\Time::generateTimestamp($le[
'expire']).
"." 196 assert(is_string($set));
201 foreach ($this->sources as
$source) {
202 $index = $source->getEntityIdFromHostPath($currenthostwithpath, $set,
$type);
211 foreach ($this->sources as $source) {
212 $index = $source->getEntityIdFromHostPath($currenthost, $set,
$type);
219 foreach ($this->sources as $source) {
220 $entityId = $source->getEntityIdFromHostPath(
'__DEFAULT__', $set,
$type);
228 'Could not find any default metadata entities in set ['.$set.
'] for host ['.$currenthost.
' : '.
229 $currenthostwithpath.
']' 246 foreach ($this->sources as
$source) {
247 $entityId = $source->getPreferredEntityIdFromCIDRhint($set, $ip);
271 assert(is_string($set));
277 assert(is_string(
$index));
279 foreach ($this->sources as
$source) {
283 if (array_key_exists(
'expire',
$metadata)) {
286 'Metadata for the entity ['.
$index.
'] expired '.
287 (time() -
$metadata[
'expire']).
' seconds ago.' 294 assert(array_key_exists(
'entityid',
$metadata));
317 assert(is_string($set));
335 assert(is_string($sha1));
336 assert(is_string($set));
340 foreach ($this->sources as
$source) {
341 $srcList = $source->getMetadataSet($set);
348 foreach (
$result as $remote_provider) {
349 if (sha1($remote_provider[
'entityid']) == $sha1) {
350 $remote_provider[
'metadata-set'] = $set;
354 $set.
'/'.var_export($remote_provider[
'entityid'],
true)
$metadata['__DYNAMIC:1__']
Attribute-related utility methods.
static getSelfHost()
Retrieve our own host.
static getSelfHostWithPath()
Retrieve our own host together with the URL path.
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.