PHP Classes

File: web/SSO/modules/saml/hooks/hook_metadata_hosted.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/saml/hooks/hook_metadata_hosted.php   Download  
File: web/SSO/modules/saml/hooks/hook_metadata_hosted.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 877 bytes
 

Contents

Class file image Download
<?php

/**
 * Hook to add the metadata for hosted entities to the frontpage.
 *
 * @param array &$metadataHosted The metadata links for hosted metadata on the frontpage.
 */
function saml_hook_metadata_hosted(&$metadataHosted) {
   
assert('is_array($metadataHosted)');

   
$sources = SimpleSAML_Auth_Source::getSourcesOfType('saml:SP');

    foreach (
$sources as $source) {

       
$metadata = $source->getMetadata();

       
$name = $metadata->getValue('name', NULL);
        if (
$name === NULL) {
           
$name = $metadata->getValue('OrganizationDisplayName', NULL);
        }
        if (
$name === NULL) {
           
$name = $source->getAuthID();
        }

       
$md = array(
           
'entityid' => $source->getEntityId(),
           
'metadata-index' => $source->getEntityId(),
           
'metadata-set' => 'saml20-sp-hosted',
           
'metadata-url' => $source->getMetadataURL() . '?output=xhtml',
           
'name' => $name,
        );

       
$metadataHosted[] = $md;
    }

}