Skip to content

Commit 8fce905

Browse files
committed
Fix
1 parent 926aa1a commit 8fce905

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/XML/SignedElementInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getValidatingCertificates(): array;
2929
* but cannot be verified, an exception will be thrown.
3030
*
3131
* @param \SimpleSAML\XMLSecurity\XMLSecurityKey $key The key we should check against.
32-
* @return bool True if successful, false if we don't have a signature that can be verified.
32+
* @return \SimpleSAML\XMLSecurity\XML\SignedElementInterface The signed element if we can verify the signature.
3333
*/
34-
public function validate(XMLSecurityKey $key): bool;
34+
public function validate(XMLSecurityKey $key): SignedElementInterface;
3535
}

src/XML/SignedElementTrait.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Exception;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\XMLSecurity\XML\ds\Signature;
10+
use SimpleSAML\XMLSecurity\XML\SignedElementInterface;
1011
use SimpleSAML\XMLSecurity\XMLSecurityKey;
1112

1213
/**
@@ -54,13 +55,13 @@ protected function setSignature(Signature $signature): void
5455
* validation fails.
5556
*
5657
* @param \SimpleSAML\XMLSecurity\XMLSecurityKey $key The key we should check against.
57-
* @return bool True on success, false when we don't have a signature.
58+
* @return \SimpleSAML\XMLSecurity\XML\SignedElementInterface The Signed element if it was validated.
5859
* @throws \Exception
5960
*/
60-
public function validate(XMLSecurityKey $key): bool
61+
public function validate(XMLSecurityKey $key): SignedElementInterface
6162
{
6263
if ($this->signature === null) {
63-
return false;
64+
throw new Exception("Unsigned element");
6465
}
6566

6667
Assert::eq(
@@ -72,7 +73,7 @@ public function validate(XMLSecurityKey $key): bool
7273
// check the signature
7374
$signer = $this->signature->getSigner();
7475
if ($signer->verify($key) === 1) {
75-
return true;
76+
return /* This should return the signed element */;
7677
}
7778

7879
throw new Exception("Unable to validate Signature");

0 commit comments

Comments
 (0)