From 5defe2e177a89766085d8d635be7833490214251 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Thu, 9 Sep 2010 07:21:03 +0000 Subject: [PATCH] ArtifactResolutionService: Return empty ArtifactResponse when receiving a duplicate ArtifactResolve. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2534 44740490-163a-0410-bde0-09ae8108e29a --- www/saml2/idp/ArtifactResolutionService.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php index d1bdf7cd0..ac4592d61 100644 --- a/www/saml2/idp/ArtifactResolutionService.php +++ b/www/saml2/idp/ArtifactResolutionService.php @@ -35,12 +35,19 @@ if (!($request instanceof SAML2_ArtifactResolve)) { throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.'); } $artifact = $request->getArtifact(); + $responseData = $store->get('artifact', $artifact); -$document = new DOMDocument(); -$document->loadXML($responseData); -$responseXML = $document->firstChild; -$artifactResponse = new SAML2_ArtifactResponse(); +$store->delete('artifact', $artifact); + +if ($responseData !== NULL) { + $document = new DOMDocument(); + $document->loadXML($responseData); + $responseXML = $document->firstChild; +} else { + $responseXML = NULL; +} +$artifactResponse = new SAML2_ArtifactResponse(); $artifactResponse->setIssuer($idpEntityId); $artifactResponse->setInResponseTo($request->getId()); $artifactResponse->setAny($responseXML); -- GitLab