| @@ 474-503 (lines=30) @@ | ||
| 471 | { |
|
| 472 | $firstAttribute = true; |
|
| 473 | $attributes = Utils::xpQuery($xml, './saml_assertion:AttributeStatement/saml_assertion:Attribute'); |
|
| 474 | foreach ($attributes as $attribute) { |
|
| 475 | if (!$attribute->hasAttribute('Name')) { |
|
| 476 | throw new \Exception('Missing name on <saml:Attribute> element.'); |
|
| 477 | } |
|
| 478 | $name = $attribute->getAttribute('Name'); |
|
| 479 | ||
| 480 | if ($attribute->hasAttribute('NameFormat')) { |
|
| 481 | $nameFormat = $attribute->getAttribute('NameFormat'); |
|
| 482 | } else { |
|
| 483 | $nameFormat = Constants::NAMEFORMAT_UNSPECIFIED; |
|
| 484 | } |
|
| 485 | ||
| 486 | if ($firstAttribute) { |
|
| 487 | $this->nameFormat = $nameFormat; |
|
| 488 | $firstAttribute = false; |
|
| 489 | } else { |
|
| 490 | if ($this->nameFormat !== $nameFormat) { |
|
| 491 | $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED; |
|
| 492 | } |
|
| 493 | } |
|
| 494 | ||
| 495 | if (!array_key_exists($name, $this->attributes)) { |
|
| 496 | $this->attributes[$name] = array(); |
|
| 497 | } |
|
| 498 | ||
| 499 | $values = Utils::xpQuery($attribute, './saml_assertion:AttributeValue'); |
|
| 500 | foreach ($values as $value) { |
|
| 501 | $this->attributes[$name][] = trim($value->textContent); |
|
| 502 | } |
|
| 503 | } |
|
| 504 | } |
|
| 505 | ||
| 506 | /** |
|
| @@ 58-87 (lines=30) @@ | ||
| 55 | ||
| 56 | $firstAttribute = true; |
|
| 57 | $attributes = Utils::xpQuery($xml, './saml_assertion:Attribute'); |
|
| 58 | foreach ($attributes as $attribute) { |
|
| 59 | if (!$attribute->hasAttribute('Name')) { |
|
| 60 | throw new \Exception('Missing name on <saml:Attribute> element.'); |
|
| 61 | } |
|
| 62 | $name = $attribute->getAttribute('Name'); |
|
| 63 | ||
| 64 | if ($attribute->hasAttribute('NameFormat')) { |
|
| 65 | $nameFormat = $attribute->getAttribute('NameFormat'); |
|
| 66 | } else { |
|
| 67 | $nameFormat = Constants::NAMEFORMAT_UNSPECIFIED; |
|
| 68 | } |
|
| 69 | ||
| 70 | if ($firstAttribute) { |
|
| 71 | $this->nameFormat = $nameFormat; |
|
| 72 | $firstAttribute = false; |
|
| 73 | } else { |
|
| 74 | if ($this->nameFormat !== $nameFormat) { |
|
| 75 | $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED; |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | if (!array_key_exists($name, $this->attributes)) { |
|
| 80 | $this->attributes[$name] = array(); |
|
| 81 | } |
|
| 82 | ||
| 83 | $values = Utils::xpQuery($attribute, './saml_assertion:AttributeValue'); |
|
| 84 | foreach ($values as $value) { |
|
| 85 | $this->attributes[$name][] = trim($value->textContent); |
|
| 86 | } |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|