Skip to content

Commit 8aabf03

Browse files
authored
Strict specs enforcement
E14: AllowCreate
1 parent 489e704 commit 8aabf03

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/XML/samlp/NameIDPolicy.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
use DOMElement;
88
use SimpleSAML\SAML2\Assert\Assert;
9+
use SimpleSAML\SAML2\Constants as C;
910
use SimpleSAML\SAML2\Exception\ArrayValidationException;
11+
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
1012
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
1113
use SimpleSAML\SAML2\Type\SAMLStringValue;
1214
use SimpleSAML\XML\ArrayizableElementInterface;
@@ -45,6 +47,15 @@ public function __construct(
4547
protected ?SAMLStringValue $SPNameQualifier = null,
4648
protected ?BooleanValue $AllowCreate = null,
4749
) {
50+
if ($AllowCreate->equals(BooleanValue::fromBoolean(true)) {
51+
// Per Errata E14: AllowCreate
52+
Assert::notSame(
53+
$Format->getValue(),
54+
C::NAMEID_TRANSIENT,
55+
ProtocolViolationException::class,
56+
"AllowCreate=true MUST NOT be used in conjunction with the urn:oasis:names:tc:SAML:2.0:nameidformat:transient <NameID> Format.",
57+
);
58+
}
4859
}
4960

5061

0 commit comments

Comments
 (0)