Skip to content

Commit

Permalink
Add variable to be able to know whether a response was signed, later …
Browse files Browse the repository at this point in the history
…in processing
  • Loading branch information
tvdijen committed Jul 29, 2024
1 parent 585e9e9 commit 97fda04
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/SAML2/Entity/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class ServiceProvider
protected SignatureAlgorithmFactory $signatureAlgorithmFactory;
protected EncryptionAlgorithmFactory $encryptionAlgorithmFactory;
protected KeyTransportAlgorithmFactory $keyTransportAlgorithmFactory;

protected bool $responseWasSigned;

/**
* @param bool $encryptedAssertions Whether assertions must be encrypted
Expand Down Expand Up @@ -160,7 +160,8 @@ public function receiveResponse(ServerRequestInterface $request): Response
}

// Verify the signature (if any)
$verifiedResponse = $rawResponse->isSigned() ? $this->verifyElementSignature($rawResponse) : $rawResponse;
$this->responseWasSigned = $rawResponse->isSigned();
$verifiedResponse = $this->responseWasSigned ? $this->verifyElementSignature($rawResponse) : $rawResponse;

$state = null;
$stateId = $verifiedResponse->getInResponseTo();
Expand Down Expand Up @@ -336,6 +337,8 @@ protected function decryptAndVerifyAssertions(array $unverifiedAssertions): arra
*/
protected function decryptElement(EncryptedElementInterface $element): EncryptableElementInterface
{
// TODO: When CBC-mode encryption is used, the assertion OR the Response must be signed

$factory = $this->encryptionAlgorithmFactory;

// If the IDP has a pre-shared key, try decrypting with that
Expand Down

0 comments on commit 97fda04

Please sign in to comment.