Skip to content

Commit a620f95

Browse files
committed
Refactor signature verification to fail fast by removing redundant algorithm type guard
1 parent 8470675 commit a620f95

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/Binding/HTTPArtifact.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use SimpleSAML\SAML2\XML\samlp\ArtifactResponse;
2525
use SimpleSAML\Store\StoreFactory;
2626
use SimpleSAML\Utils\HTTP;
27-
use SimpleSAML\XMLSchema\Type\AnyURIValue;
2827
use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory;
2928
use SimpleSAML\XMLSecurity\Key\PublicKey;
3029
use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock;
@@ -250,8 +249,12 @@ private function verifyArtifactResponseSignature(
250249
throw new Exception('No signing keys found in IdP metadata.');
251250
}
252251

253-
$alg = $artifactResponse->getSignature()->getSignedInfo()->getSignatureMethod()->getAlgorithm();
254-
$signatureMethod = $alg instanceof AnyURIValue ? $alg->getValue() : (string) $alg;
252+
$signatureMethod = $artifactResponse
253+
->getSignature()
254+
->getSignedInfo()
255+
->getSignatureMethod()
256+
->getAlgorithm()
257+
->getValue();
255258

256259
$factory = new SignatureAlgorithmFactory();
257260

0 commit comments

Comments
 (0)