diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 1efd6b01a633c67cfe929eff601e60d4d515994a..22557766d2644f80e46e84bee96016c444a4ee8a 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -86,6 +86,13 @@ class SimpleSAML_Metadata_SAMLParser { */ private $organizationURL = array(); + + /** + * This is an array of the Contact Persons of this entity. + */ + private $contacts = array(); + + private $scopes; private $attributes; private $tags; @@ -149,6 +156,12 @@ class SimpleSAML_Metadata_SAMLParser { if ($entityElement->Organization) { $this->processOrganization($entityElement->Organization); } + + if(!empty($entityElement->ContactPerson)) { + foreach($entityElement->ContactPerson as $contact) { + $this->processContactPerson($contact); + } + } } @@ -389,6 +402,11 @@ class SimpleSAML_Metadata_SAMLParser { $ret['OrganizationURL'] = $this->organizationURL; } + /* + * Add contact metadata + */ + $ret['contacts'] = $this->contacts; + return $ret; } @@ -891,6 +909,38 @@ class SimpleSAML_Metadata_SAMLParser { $this->organizationURL = $element->OrganizationURL; } + /** + * Parse and process a ContactPerson element. + * + * @param SAML2_XML_md_ContactPerson $element The ContactPerson element. + */ + + private function processContactPerson(SAML2_XML_md_ContactPerson $element) { + + $contactPerson = array(); + if(!empty($element->contactType)) { + $contactPerson['contactType'] = $element->contactType; + } + if(!empty($element->Company)) { + $contactPerson['company'] = $element->Company; + } + if(!empty($element->GivenName)) { + $contactPerson['givenName'] = $element->GivenName; + } + if(!empty($element->SurName)) { + $contactPerson['surName'] = $element->SurName; + } + if(!empty($element->EmailAddress)) { + $contactPerson['emailAddress'] = $element->EmailAddress; + } + if(!empty($element->TelephoneNumber)) { + $contactPerson['telephoneNumber'] = $element->TelephoneNumber; + } + if(!empty($contactPerson)) { + $this->contacts[] = $contactPerson; + } + } + /** * This function parses AttributeConsumerService elements.