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

SAMLParser: Add support for extracting AttributeAuthorityDescriptor elements.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1960 44740490-163a-0410-bde0-09ae8108e29a
parent 29870182
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,14 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -84,6 +84,14 @@ class SimpleSAML_Metadata_SAMLParser {
private $idpDescriptors; private $idpDescriptors;
/**
* List of attribute authorities we have found.
*
* @var array
*/
private $attributeAuthorityDescriptors = array();
/** /**
* This is an associative array with the organization name for this entity. The key of * This is an associative array with the organization name for this entity. The key of
* the associative array is the language code, while the value is a string with the * the associative array is the language code, while the value is a string with the
...@@ -187,6 +195,10 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -187,6 +195,10 @@ class SimpleSAML_Metadata_SAMLParser {
$this->processIDPSSODescriptor($child, $expireTime); $this->processIDPSSODescriptor($child, $expireTime);
} }
if(SimpleSAML_Utilities::isDOMElementOfType($child, 'AttributeAuthorityDescriptor', '@md') === TRUE) {
$this->processAttributeAuthorityDescriptor($child, $expireTime);
}
if(SimpleSAML_Utilities::isDOMElementOfType($child, 'Organization', '@md') === TRUE) { if(SimpleSAML_Utilities::isDOMElementOfType($child, 'Organization', '@md') === TRUE) {
$this->processOrganization($child); $this->processOrganization($child);
} }
...@@ -722,6 +734,17 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -722,6 +734,17 @@ class SimpleSAML_Metadata_SAMLParser {
} }
/**
* Retrieve AttributeAuthorities from the metadata.
*
* @return array Array of AttributeAuthorityDescriptor entries.
*/
public function getAttributeAuthorities() {
return $this->attributeAuthorityDescriptors;
}
/** /**
* Parse a RoleDescriptorType element. * Parse a RoleDescriptorType element.
* *
...@@ -870,6 +893,36 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -870,6 +893,36 @@ class SimpleSAML_Metadata_SAMLParser {
} }
/**
* This function extracts metadata from a AttributeAuthorityDescriptor element.
*
* @param DOMElement $element The element which should be parsed.
* @param int|NULL $expireTime The unix timestamp for when this element should expire, or
* NULL if unknwon.
*/
private function processAttributeAuthorityDescriptor(DOMElement $element, $expireTime) {
assert('is_null($expireTime) || is_int($expireTime)');
$aad = self::parseRoleDescriptorType($element, $expireTime);
$aad['metadata-set'] = 'attributeauthority-remote';
$extensions = SimpleSAML_Utilities::getDOMChildren($element, 'Extensions', '@md');
if (!empty($extensions))
$this->processExtensions($extensions[0]);
if (!empty($this->scopes)) $aad['scopes'] = $this->scopes;
$aad['AttributeService'] = self::extractEndpoints($element, 'AttributeService', FALSE);
$aad['AssertionIDRequestService'] = self::extractEndpoints($element, 'AssertionIDRequestService', FALSE);
$aad['NameIDFormat'] = array_map(
array('SimpleSAML_Utilities', 'getDOMText'),
SimpleSAML_Utilities::getDOMChildren($element, 'NameIDFormat', '@md')
);
$this->attributeAuthorityDescriptors[] = $aad;
}
/** /**
* Parse and process a Extensions element. * Parse and process a Extensions element.
* *
......
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