Skip to content
Snippets Groups Projects
Commit a638b14c authored by Olav Morken's avatar Olav Morken
Browse files

SAMLParser: Extract contact persons.

Thanks to Sixto Martin for providing this patch.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2628 44740490-163a-0410-bde0-09ae8108e29a
parent 14f7b184
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment