Skip to content
Snippets Groups Projects
Commit 6a2deaca authored by Olav Morken's avatar Olav Morken
Browse files

IdP/Artifact: Use the new datastore to store artifacts.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2491 44740490-163a-0410-bde0-09ae8108e29a
parent a7e38a70
No related branches found
No related tags found
No related merge requests found
......@@ -20,11 +20,18 @@ class SAML2_HTTPArtifact extends SAML2_Binding {
*/
public function getRedirectURL(SAML2_Message $message) {
$store = SimpleSAML_Store::getInstance();
if ($store === FALSE) {
throw new Exception('Unable to send artifact without a datastore configured.');
}
$generatedId = pack('H*', ((string) SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(20))));
$artifact = base64_encode("\x00\x04\x00\x00" . sha1($message->getIssuer(), TRUE) . $generatedId) ;
$artifactData = $message->toUnsignedXML();
$artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
SimpleSAML_Memcache::set('artifact:' . $artifact, $artifactDataString);
$store->set('artifact', $artifact, $artifactDataString, time() + 15*60);
$params = array(
'SAMLart' => $artifact,
);
......
......@@ -24,13 +24,18 @@ if (!$idpMetadata->getBoolean('saml20.sendartifact', FALSE)) {
throw new SimpleSAML_Error_Error('NOACCESS');
}
$store = SimpleSAML_Store::getInstance();
if ($store === FALSE) {
throw new Exception('Unable to send artifact without a datastore configured.');
}
$binding = new SAML2_SOAP();
$request = $binding->receive();
if (!($request instanceof SAML2_ArtifactResolve)) {
throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.');
}
$artifact = $request->getArtifact();
$responseData = SimpleSAML_Memcache::get('artifact:' . $artifact);
$responseData = $store->get('artifact', $artifact);
$document = new DOMDocument();
$document->loadXML($responseData);
$responseXML = $document->firstChild;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment