File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 77use Exception ;
88use SimpleSAML \Assert \Assert ;
99use SimpleSAML \XMLSecurity \XML \ds \Signature ;
10+ use SimpleSAML \XMLSecurity \XML \SignedElementInterface ;
1011use 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 " );
You can’t perform that action at this time.
0 commit comments