Skip to content

Commit 7333b2c

Browse files
committed
Pin the default coverage requirement against a real peer
One row proves the default accepts a WSS4J-signed message; its control proves requiring the Security header contents refuses the same message, because WSS4J does not sign its own BinarySecurityToken. That is why the default stops at the Body.
1 parent 06266c9 commit 7333b2c

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/Wsse/SignatureInteropTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,39 @@ public function test_wss4j_signed_happy_flow_is_accepted_by_php(): void
129129
self::assertStringContainsString('hello from the interop harness', $javaSigned);
130130
}
131131

132+
/**
133+
* The default coverage requirement against a real peer. WSS4J signs the Body and the Timestamp and leaves
134+
* its own BinarySecurityToken unsigned, which is why the default stops at the Body: requiring the whole
135+
* Security header contents would refuse this message.
136+
*/
137+
public function test_wss4j_signed_happy_flow_is_accepted_by_php_with_the_default_coverage(): void
138+
{
139+
$javaSigned = Oracle::post('/sign', Oracle::sampleEnvelope())['body'];
140+
141+
$document = Document::fromXmlString($javaSigned);
142+
$context = new WsseContext($document, SoapVersion::Soap12, new SecurityProfile());
143+
$trust = TrustStore::fromCertificates(Certificate::fromFile(Oracle::certPath('ca.crt')));
144+
145+
(new Inbound\VerifySignature($trust))($context);
146+
147+
self::assertStringContainsString('hello from the interop harness', $javaSigned);
148+
}
149+
150+
/**
151+
* The control for the row above: requiring the Security header contents refuses the same message, because
152+
* WSS4J does not sign its own BinarySecurityToken.
153+
*/
154+
public function test_wss4j_signed_happy_flow_is_refused_when_the_header_contents_are_required(): void
155+
{
156+
$javaSigned = Oracle::post('/sign', Oracle::sampleEnvelope())['body'];
157+
158+
self::assertPhpRejects(
159+
$javaSigned,
160+
[Part::body(), Part::securityHeaderContents()],
161+
TrustStore::fromCertificates(Certificate::fromFile(Oracle::certPath('ca.crt'))),
162+
);
163+
}
164+
132165
public function test_wss4j_signed_rsa_sha512_is_accepted_by_php(): void
133166
{
134167
$javaSigned = Oracle::post('/sign?sigalg=RSA_SHA512', Oracle::sampleEnvelope())['body'];

0 commit comments

Comments
 (0)