Skip to content

Commit 1a051f6

Browse files
committed
Any signed element should have a signature set
1 parent 198ec0d commit 1a051f6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/XML/SignedElementTrait.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ trait SignableElementTrait
2727
/**
2828
* Get the signature element of this object.
2929
*
30-
* @return \SimpleSAML\XMLSecurity\XML\ds\Signature|null
30+
* @return \SimpleSAML\XMLSecurity\XML\ds\Signature
3131
*/
3232
public function getSignature(): ?Signature
3333
{
@@ -38,13 +38,11 @@ public function getSignature(): ?Signature
3838
/**
3939
* Initialize a signed element from XML.
4040
*
41-
* @param \SimpleSAML\XMLSecurity\XML\ds\Signature|null $signature The ds:Signature object
41+
* @param \SimpleSAML\XMLSecurity\XML\ds\Signature $signature The ds:Signature object
4242
*/
43-
protected function setSignature(?Signature $signature): void
43+
protected function setSignature(Signature $signature): void
4444
{
45-
if ($signature) {
46-
$this->signature = $signature;
47-
}
45+
$this->signature = $signature;
4846
}
4947

5048

@@ -89,9 +87,6 @@ public function validate(XMLSecurityKey $key): bool
8987
*/
9088
public function getValidatingCertificates(): array
9189
{
92-
if ($this->signature === null) {
93-
return [];
94-
}
9590
$ret = [];
9691
foreach ($this->signature->getCertificates() as $cert) {
9792
// extract the public key from the certificate for validation.

0 commit comments

Comments
 (0)