File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,6 +276,10 @@ public function getTrustMarkOwners(): ?TrustMarkOwnersClaimBag
276276 }
277277
278278
279+ /**
280+ * @throws \SimpleSAML\OpenID\Exceptions\JwsException
281+ * @throws \SimpleSAML\OpenID\Exceptions\EntityStatementException
282+ */
279283 public function getTrustMarkIssuers (): ?TrustMarkIssuersClaimBag
280284 {
281285 // trust_mark_issuers
@@ -291,6 +295,10 @@ public function getTrustMarkIssuers(): ?TrustMarkIssuersClaimBag
291295 return null ;
292296 }
293297
298+ if (!$ this ->isConfiguration ()) {
299+ throw new EntityStatementException ('Trust Mark Issuers claim encountered in non-configuration statement. ' );
300+ }
301+
294302 return $ this ->claimFactory ->forFederation ()->buildTrustMarkIssuersClaimBagFrom ($ trustMarkIssuersClaimData );
295303 }
296304
Original file line number Diff line number Diff line change @@ -396,6 +396,23 @@ public function testTrustMarkIssuersIsBuildUsingFactoryOptional(): void
396396 }
397397
398398
399+ public function testTrustMarkIssuersClaimIsAllowedInConfigurationStatementOnly (): void
400+ {
401+ $ this ->validPayload ['trust_mark_issuers ' ] = [
402+ 'trustMarkType ' => ['https://issuer1.org ' , 'https://issuer2.org ' ],
403+ ];
404+ $ this ->validPayload ['iss ' ] = 'something-else ' ;
405+
406+ $ this ->expectException (JwsException::class);
407+ $ this ->expectExceptionMessage ('non-configuration ' );
408+
409+ $ this ->signatureMock ->method ('getProtectedHeader ' )->willReturn ($ this ->sampleHeader );
410+ $ this ->jsonHelperMock ->method ('decode ' )->willReturn ($ this ->validPayload );
411+
412+ $ this ->sut ()->getTrustMarkIssuers ();
413+ }
414+
415+
399416 public function testThrowsOnInvalidTrustMarks (): void
400417 {
401418 $ this ->validPayload ['trust_marks ' ] = 'invalid ' ;
You can’t perform that action at this time.
0 commit comments