$idp_key = $autoconfig->getValue('sts_key'); $token->addIDPKey($idp_key); $token->addSTSCertificate(''); $claims = $token->process($_POST['xmlToken']); if ($claims->isValid() && $claims->privatepersonalidentifier != NULL) { $ppid = $claims->privatepersonalidentifier; SimpleSAML_Logger::debug("PPID = {$ppid}"); $ICconfig['InfoCard'] = $Infocard; $ICconfig['InfoCard']['issuer'] = $autoconfig->getValue('tokenserviceurl'); //sspmod_InfoCard_Utils::getIssuer($sts_crt); $ICconfig['tokenserviceurl'] = $autoconfig->getValue('tokenserviceurl'); $ICconfig['mexurl'] = $autoconfig->getValue('mexurl'); $ICconfig['sts_key'] = $autoconfig->getValue('sts_key'); $ICconfig['certificates'] = $autoconfig->getValue('certificates'); $ICconfig['UserCredential'] = $autoconfig->getValue('UserCredential'); $ICdata = sspmod_InfoCard_UserFunctions::fillICdata($username, $userCredential, $ppid); $IC = sspmod_InfoCard_STS::createCard($ICdata, $ICconfig); header('Content-Disposition: attachment; filename="' . $ICdata['CardName'] . '.crd"'); header('Content-Type: application/x-informationcard'); header('Content-Length:' . strlen($IC)); echo $IC; $state = 'end'; } else { SimpleSAML_Logger::debug('Wrong Self-Issued card'); $error = 'wrong_IC'; $state = "selfIssued"; } } else { SimpleSAML_Logger::debug('NO HAY XML TOKEN'); $error = NULL; $state = "selfIssued";
throw new SimpleSAML_Error_NotFound('The URL wasn\'t found in the module.'); } /* Load the configuration. */ $internalkey = hash('sha256', $autoconfig->getValue('internal_key')); $certificates = $autoconfig->getValue('certificates'); $ICconfig['InfoCard'] = $autoconfig->getValue('InfoCard'); $ICconfig['InfoCard']['issuer'] = $autoconfig->getValue('tokenserviceurl'); //sspmod_InfoCard_Utils::getIssuer($sts_crt); $ICconfig['tokenserviceurl'] = $autoconfig->getValue('tokenserviceurl'); $ICconfig['mexurl'] = $autoconfig->getValue('mexurl'); $ICconfig['sts_key'] = $autoconfig->getValue('sts_key'); $ICconfig['certificates'] = $autoconfig->getValue('certificates'); $ICconfig['UserCredential'] = $autoconfig->getValue('UserCredential'); $IC_lifetime_delivery = $autoconfig->getValue('IC_lifetime_delivery'); $DB_params = $autoconfig->getValue('DB_params'); // Encryption $request = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, pack("H*", $internalkey), $encrequest, MCRYPT_MODE_CBC, $iv); $parsed_request = is_card_enabled($request, $IC_lifetime_delivery); if ($parsed_request && DB_update_connected_user($parsed_request[0], $DB_params)) { // Calculate PPID $ppid = base64_encode(calculate_PPID($parsed_request[1], $certificates)); // Create InfoCard $ICdata = sspmod_InfoCard_UserFunctions::fillICdata($parsed_request[0], $ICconfig['UserCredential'], $ppid); $IC = sspmod_InfoCard_STS::createCard($ICdata, $ICconfig); disable_download($request); //Send Infocard print $IC; } else { throw new SimpleSAML_Error_NotFound('The URL wasn\'t found in the module.'); } }