Revision: 2173
Author: olavmrk
Date: Thu Feb 11 23:25:04 2010
Log: SAMLParser: Extract NameFormat from attributes.
http://code.google.com/p/simplesamlphp/source/detail?r=2173
Modified:
/trunk/lib/SimpleSAML/Metadata/SAMLParser.php
=======================================
--- /trunk/lib/SimpleSAML/Metadata/SAMLParser.php Wed Feb 10 03:32:00 2010
+++ /trunk/lib/SimpleSAML/Metadata/SAMLParser.php Thu Feb 11 23:25:04 2010
@@ -518,6 +518,9 @@
if (array_key_exists('attributes', $spd)) {
$ret['attributes'] = $spd['attributes'];
}
+ if (array_key_exists('attributes.NameFormat', $spd)) {
+ $ret['attributes.NameFormat'] =
$spd['attributes.NameFormat'];
+ }
/* Add name & description. */
if (array_key_exists('name', $spd)) {
@@ -667,6 +670,9 @@
if (array_key_exists('attributes', $spd)) {
$ret['attributes'] = $spd['attributes'];
}
+ if (array_key_exists('attributes.NameFormat', $spd)) {
+ $ret['attributes.NameFormat'] =
$spd['attributes.NameFormat'];
+ }
/* Add name & description. */
if (array_key_exists('name', $spd)) {
@@ -1083,12 +1089,39 @@
$sp['description'][$language] =
SimpleSAML_Utilities::getDOMText($child);
}
+
+ $format = NULL;
$elements =
SimpleSAML_Utilities::getDOMChildren($element, 'RequestedAttribute', '@md');
+ $sp['attributes'] = array();
foreach($elements AS $child) {
$attrname = $child->getAttribute('Name');
- if (!array_key_exists('attributes', $sp))
$sp['attributes'] = array();
$sp['attributes'][] = $attrname;
- }
+
+ if ($child->hasAttribute('NameFormat')) {
+ $attrformat =
$child->getAttribute('NameFormat');
+ } else {
+ $attrformat =
SAML2_Const::NAMEFORMAT_UNSPECIFIED;
+ }
+
+ if ($format === NULL) {
+ $format = $attrformat;
+ } elseif ($format !== $attrformat) {
+ $format = SAML2_Const::NAMEFORMAT_UNSPECIFIED;
+ }
+
+ }
+
+ if (empty($sp['attributes'])) {
+ /*
+ * Really an invalid configuration - all
AttributeConsumingServices
+ * should have one or more attributes.
+ */
+ unset($sp['attributes']);
+ }
+
+ if ($format !== SAML2_Const::NAMEFORMAT_UNSPECIFIED && $format !== NULL)
{
+ $sp['attributes.NameFormat'] = $format;
+ }
}
--
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en.