Skip to content
Snippets Groups Projects
Commit 2c7bd39d authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Fix bug with assertion signing, now using correct ID attribute of the assertion element

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@841 44740490-163a-0410-bde0-09ae8108e29a
parent d6d38a3b
No related branches found
No related tags found
No related merge requests found
......@@ -97,16 +97,7 @@ class SimpleSAML_Bindings_Shib13_HTTPPost {
$passphrase = NULL;
}
$signer = new SimpleSAML_XML_Signer(array(
'privatekey' => $idpmd['privatekey'],
'privatekey_pass' => $passphrase,
'certificate' => $idpmd['certificate'],
'id' => 'ResponseID',
));
if(array_key_exists('certificatechain', $idpmd)) {
$signer->addCertificate($idpmd['certificatechain']);
}
$responsedom = new DOMDocument();
$responsedom->loadXML(str_replace ("\r", "", $response));
......@@ -138,11 +129,19 @@ class SimpleSAML_Bindings_Shib13_HTTPPost {
}
if(!$signResponse) {
$signer->sign($firstassertionroot, $firstassertionroot);
$signer = new SimpleSAML_XML_Signer(array(
'privatekey' => $idpmd['privatekey'],
'privatekey_pass' => $passphrase,
'certificate' => $idpmd['certificate'],
'id' => ($signResponse ? 'ResponseID' : 'AssertionID') ,
));
if(array_key_exists('certificatechain', $idpmd)) {
$signer->addCertificate($idpmd['certificatechain']);
}
if($signResponse) {
/* Sign the response - this must be done after encrypting the assertion. */
......@@ -151,8 +150,15 @@ class SimpleSAML_Bindings_Shib13_HTTPPost {
assert('count($statusElements) === 1');
$signer->sign($responseroot, $responseroot, $statusElements[0]);
} else {
/* Sign the assertion */
$signer->sign($firstassertionroot, $firstassertionroot);
}
$response = $responsedom->saveXML();
......
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