Skip to content
Snippets Groups Projects
Commit 5f46f4a7 authored by Hans Zandbelt's avatar Hans Zandbelt
Browse files

implement nameid stuff and extra check on sp entityid setting

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1529 44740490-163a-0410-bde0-09ae8108e29a
parent 6f3daa47
No related branches found
No related tags found
No related merge requests found
......@@ -190,7 +190,12 @@ if (!$session->isValid($authority) ) {
$spentityid = $requestcache['Issuer'];
$spmetadata = SimpleSAML_Configuration::getConfig('adfs-sp-remote.php');
$spmetadata = SimpleSAML_Configuration::loadFromArray($spmetadata->getValue($spentityid));
$arr = $spmetadata->getValue($spentityid);
if (!isset($arr)) {
throw new Exception('Metadata for ADFS SP "' . $spentityid . '" could not be found in adfs-sp-remote.php!');
}
$spmetadata = SimpleSAML_Configuration::loadFromArray($arr);
$sp_name = $spmetadata->getValue('name', $spentityid);
......@@ -241,8 +246,17 @@ if (!$session->isValid($authority) ) {
if (array_key_exists('RelayState', $requestcache)) $relayState = $requestcache['RelayState'];
$nameid = $session->getNameID();
$nameid = $nameid['value'];
$nameidattribute = $spmetadata->getValue('simplesaml.nameidattribute');
if (isset($nameidattribute)) {
if (!array_key_exists($nameidattribute, $attributes)) {
throw new Exception('simplesaml.nameidattribute does not exist in resulting attribute set');
}
$nameid = $attributes[$nameidattribute][0];
}
$response = ADFS_GenerateResponse($idpentityid, $spentityid, $nameid['value'], $attributes);
$response = ADFS_GenerateResponse($idpentityid, $spentityid, $nameid, $attributes);
$wresult = ADFS_SignResponse($response, $config->getPathValue('certdir') . $adfsconfig->getValue('key'), $config->getPathValue('certdir') . $adfsconfig->getValue('cert'));
ADFS_PostResponse($spmetadata->getValue('prp'), $wresult, $relayState);
......
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