Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
56 righe
2.0 KiB
56 righe
2.0 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if ($_SESSION["ente"]->checkSPID()) { |
|
if (isset($_POST) && ! empty($_POST["provider"])) { |
|
|
|
$sp = new Italia\Spid\Sp($spid); |
|
|
|
$mapping = $sp->getIdpList(); |
|
$idpKey = null; |
|
foreach($mapping AS $key => $entityID) { |
|
if ($_POST["provider"] === $entityID) { |
|
$idpKey = $key; |
|
} |
|
} |
|
if($idpKey) { |
|
$url = $sp->login($idpKey, $_SESSION["ente"]->getInfo()["indice_spid"], 0, 2, "", false); |
|
if(! empty($url)) { |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_log_spid"; |
|
$salva->operazione = "INSERT"; |
|
$salva->oggetto = SpidSA::requestLog($url); |
|
$codice = $salva->save(); |
|
|
|
if(! empty($codice)) { |
|
$_SESSION["spidLoginRequestID"] = $codice; |
|
header("Pragma: no-cache"); |
|
header("Cache-Control: no-cache, must-revalidate"); |
|
header("Location: {$url}"); |
|
die(); |
|
} |
|
|
|
} else { |
|
unset($_SESSION["spidLoginRequestID"]); |
|
unset($_SESSION['spidSession']); |
|
header('Location: '.$_SERVER['REQUEST_URI']); |
|
die(); |
|
|
|
} |
|
} else { |
|
$_SESSION["spidError"] = "Errore nella richiesta"; |
|
$_SESSION["spidErrorCode"] = "#404#"; |
|
} |
|
|
|
} else { |
|
$_SESSION["spidError"] = "Errore nella richiesta"; |
|
$_SESSION["spidErrorCode"] = "#400#"; |
|
} |
|
} else { |
|
$_SESSION["spidError"] = "SPID non abilitato"; |
|
$_SESSION["spidErrorCode"] = "##"; |
|
} |
|
|
|
header("Location: /index.php");
|
|
|