Skip to content

Commit

Permalink
Ensure the attribute name matches the NameFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 19, 2024
1 parent 65a67f6 commit afae4f3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/SAML2/XML/saml/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public function __construct(
Assert::maxCount($attributeValue, C::UNBOUNDED_LIMIT);
Assert::allIsInstanceOf($attributeValue, AttributeValue::class, 'Invalid AttributeValue.');

if ($nameFormat === C::NAMEFORMAT_URI) {
Assert::validURI($name, "Attribute name does not match its declared format");
} elseif ($nameFormat === C::NAMEFORMAT_BASIC) {
Assert::validNCName($name, "Attribute name does not match its declared format");
}

$this->setAttributesNS($namespacedAttribute);
}

Expand Down

0 comments on commit afae4f3

Please sign in to comment.