Skip to content

Commit

Permalink
Ensure the NameID value matches the Format
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 19, 2024
1 parent afae4f3 commit 7a328da
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/SAML2/XML/saml/NameID.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ public function __construct(
?string $Format = null,
?string $SPProvidedID = null,
) {
if ($Format === C::NAMEID_EMAIL_ADDRESS) {

Check failure on line 44 in src/SAML2/XML/saml/NameID.php

View workflow job for this annotation

GitHub Actions / Quality control

Access to constant NAMEID_EMAIL_ADDRESS on an unknown class SimpleSAML\SAML2\XML\saml\C.
Assert::email(
$value,
"The content %s of the NameID was not in the format specified by the Format attribute",
);
}

if ($Format === C::NAMEID_ENTITY) {

Check failure on line 51 in src/SAML2/XML/saml/NameID.php

View workflow job for this annotation

GitHub Actions / Quality control

Access to constant NAMEID_ENTITY on an unknown class SimpleSAML\SAML2\XML\saml\C.
Assert::null($NameQualifier, "Entity Identifier included a disallowed NameQualifier attribute.");
Assert::null($SPNameQualifier, "Entity Identifier included a disallowed SPNameQualifier attribute.");
Assert::null($SPProvidedID, "Entity Identifier included a disallowed SPProvidedID attribute.");
}

parent::__construct($value, $NameQualifier, $SPNameQualifier, $Format, $SPProvidedID);
}

Expand Down

0 comments on commit 7a328da

Please sign in to comment.