/**
* This function is used to generate some metadata elements automatically.
*
* @param $property The metadata property which should be autogenerated.
* @param $set The set we the property comes from.
* @return The autogenerated metadata property.
*/
public function getGenerated($property, $set = 'saml20-sp-hosted')
{
/* First we check if the user has overridden this property in the metadata. */
try {
$metadataSet = $this->getMetaDataCurrent($set);
if (array_key_exists($property, $metadataSet)) {
return $metadataSet[$property];
}
} catch (Exception $e) {
/* Probably metadata wasn't found. In any case we continue by generating the metadata. */
}
/* Get the configuration. */
$config = SimpleSAML_Configuration::getInstance();
assert($config instanceof SimpleSAML_Configuration);
$baseurl = SimpleSAML_Utilities::selfURLhost() . '/' . $config->getBaseURL();
if ($set == 'saml20-sp-hosted') {
switch ($property) {
case 'AssertionConsumerService':
return $baseurl . 'saml2/sp/AssertionConsumerService.php';
case 'SingleLogoutService':
return $baseurl . 'saml2/sp/SingleLogoutService.php';
case 'SingleLogoutServiceBinding':
return SAML2_Const::BINDING_HTTP_REDIRECT;
}
} elseif ($set == 'saml20-idp-hosted') {
switch ($property) {
case 'SingleSignOnService':
return $baseurl . 'saml2/idp/SSOService.php';
case 'SingleSignOnServiceBinding':
return SAML2_Const::BINDING_HTTP_REDIRECT;
case 'SingleLogoutService':
return $baseurl . 'saml2/idp/SingleLogoutService.php';
case 'SingleLogoutServiceBinding':
return SAML2_Const::BINDING_HTTP_REDIRECT;
}
} elseif ($set == 'shib13-sp-hosted') {
switch ($property) {
case 'AssertionConsumerService':
return $baseurl . 'shib13/sp/AssertionConsumerService.php';
}
} elseif ($set == 'shib13-idp-hosted') {
switch ($property) {
case 'SingleSignOnService':
return $baseurl . 'shib13/idp/SSOService.php';
}
}
throw new Exception('Could not generate metadata property ' . $property . ' for set ' . $set . '.');
}