Skip to content

Commit 6a2deac

Browse files
committed
IdP/Artifact: Use the new datastore to store artifacts.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2491 44740490-163a-0410-bde0-09ae8108e29a
1 parent a7e38a7 commit 6a2deac

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

lib/SAML2/HTTPArtifact.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,18 @@ class SAML2_HTTPArtifact extends SAML2_Binding {
2020
*/
2121
public function getRedirectURL(SAML2_Message $message) {
2222

23+
$store = SimpleSAML_Store::getInstance();
24+
if ($store === FALSE) {
25+
throw new Exception('Unable to send artifact without a datastore configured.');
26+
}
27+
2328
$generatedId = pack('H*', ((string) SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(20))));
2429
$artifact = base64_encode("\x00\x04\x00\x00" . sha1($message->getIssuer(), TRUE) . $generatedId) ;
2530
$artifactData = $message->toUnsignedXML();
2631
$artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
27-
SimpleSAML_Memcache::set('artifact:' . $artifact, $artifactDataString);
32+
33+
$store->set('artifact', $artifact, $artifactDataString, time() + 15*60);
34+
2835
$params = array(
2936
'SAMLart' => $artifact,
3037
);

www/saml2/idp/ArtifactResolutionService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@
2424
throw new SimpleSAML_Error_Error('NOACCESS');
2525
}
2626

27+
$store = SimpleSAML_Store::getInstance();
28+
if ($store === FALSE) {
29+
throw new Exception('Unable to send artifact without a datastore configured.');
30+
}
31+
2732
$binding = new SAML2_SOAP();
2833
$request = $binding->receive();
2934
if (!($request instanceof SAML2_ArtifactResolve)) {
3035
throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.');
3136
}
3237
$artifact = $request->getArtifact();
33-
$responseData = SimpleSAML_Memcache::get('artifact:' . $artifact);
38+
$responseData = $store->get('artifact', $artifact);
3439
$document = new DOMDocument();
3540
$document->loadXML($responseData);
3641
$responseXML = $document->firstChild;

0 commit comments

Comments
 (0)