SimpleSAML_Logger::critical('consentAdmin: sp: ' . $sp_entityid . ' action: ' . $action);
// Remove services, whitch have consent disabled
if (isset($idp_metadata['consent.disable'])) {
foreach ($idp_metadata['consent.disable'] as $disable) {
if (array_key_exists($disable, $all_sp_metadata)) {
unset($all_sp_metadata[$disable]);
}
}
}
SimpleSAML_Logger::info('consentAdmin: ' . $idp_entityid);
// Calc correct source
$source = $idp_metadata['metadata-set'] . '|' . $idp_entityid;
// Parse consent config
$consent_storage = sspmod_consent_Store::parseStoreConfig($cA_config->getValue('consentadmin'));
// Calc correct user ID hash
$hashed_user_id = sspmod_consent_Auth_Process_Consent::getHashedUserID($userid, $source);
// If a checkbox have been clicked
if ($action != null && $sp_entityid != null) {
// Get SP metadata
$sp_metadata = $metadata->getMetaData($sp_entityid, 'saml20-sp-remote');
// Run AuthProc filters
list($targeted_id, $attribute_hash, $attributes_new) = driveProcessingChain($idp_metadata, $source, $sp_metadata, $sp_entityid, $attributes, $userid, $hashAttributes);
// Add a consent (or update if attributes have changed and old consent for SP and IdP exists)
if ($action == 'true') {
$isStored = $consent_storage->saveConsent($hashed_user_id, $targeted_id, $attribute_hash);
if ($isStored) {
$res = "added";
} else {
$res = "updated";
}
// Remove consent