Skip to content

Commit 3ffc27d

Browse files
committed
Never send mustUnderstand=<false> .. It is illegal
1 parent 97e1183 commit 3ffc27d

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/XML/ecp/RequestAuthenticated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function toXML(?DOMElement $parent = null): DOMElement
9393
{
9494
$e = $this->instantiateParentElement($parent);
9595

96-
if ($this->getMustUnderstand() !== null) {
96+
if ($this->getMustUnderstand() !== null && $this->getMustUnderstand()->toBoolean() !== false) {
9797
$this->getMustUnderstand()->toAttribute()->toXML($e);
9898
}
9999

tests/SAML2/XML/ecp/RequestAuthenticatedTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function setUpBeforeClass(): void
4848
public function testMarshalling(): void
4949
{
5050
$ra = new RequestAuthenticated(
51-
MustUnderstandValue::fromBoolean(false),
51+
MustUnderstandValue::fromBoolean(true),
5252
);
5353

5454
$this->assertEquals(
@@ -58,6 +58,19 @@ public function testMarshalling(): void
5858
}
5959

6060

61+
/**
62+
*/
63+
public function testMarshallingMustUnderstandFalseIsIgnored(): void
64+
{
65+
$ra = new RequestAuthenticated(
66+
MustUnderstandValue::fromBoolean(false),
67+
);
68+
69+
$xml = $ra->toXML();
70+
$this->assertFalse($xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'));
71+
}
72+
73+
6174
/**
6275
*/
6376
public function testUnmarshallingWithMissingActorThrowsException(): void
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<ecp:RequestAuthenticated xmlns:ecp="urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:mustUnderstand="0" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" />
1+
<ecp:RequestAuthenticated xmlns:ecp="urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:mustUnderstand="1" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" />

0 commit comments

Comments
 (0)