SimpleSAML_Metadata_MetaDataStorageHandler::getGenerated PHP Метод

getGenerated() публичный Метод

This function is used to generate some metadata elements automatically.
public getGenerated ( string $property, string $set ) : string
$property string The metadata property which should be auto-generated.
$set string The set we the property comes from.
Результат string The auto-generated metadata property.
    public function getGenerated($property, $set)
    {
        // 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\Utils\HTTP::getSelfURLHost() . $config->getBasePath();
        if ($set == 'saml20-sp-hosted') {
            if ($property === 'SingleLogoutServiceBinding') {
                return \SAML2\Constants::BINDING_HTTP_REDIRECT;
            }
        } elseif ($set == 'saml20-idp-hosted') {
            switch ($property) {
                case 'SingleSignOnService':
                    return $baseurl . 'saml2/idp/SSOService.php';
                case 'SingleSignOnServiceBinding':
                    return \SAML2\Constants::BINDING_HTTP_REDIRECT;
                case 'SingleLogoutService':
                    return $baseurl . 'saml2/idp/SingleLogoutService.php';
                case 'SingleLogoutServiceBinding':
                    return \SAML2\Constants::BINDING_HTTP_REDIRECT;
            }
        } elseif ($set == 'shib13-idp-hosted') {
            if ($property === 'SingleSignOnService') {
                return $baseurl . 'shib13/idp/SSOService.php';
            }
        }
        throw new Exception('Could not generate metadata property ' . $property . ' for set ' . $set . '.');
    }