gestione gare pubbliche
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.
 
 
 
 
 

44 righe
1.5 KiB

<?php
use \Studioamica\OidcClient\Utils\Config as OIDC_Config;
use \Studioamica\OidcClient\Endpoints\Authorize;
use \Studioamica\OidcClient\Utils\FlowException;
$configPath = substr(__DIR__, 0, strpos(__DIR__, "/public_html")) . "/config.php";
include_once($configPath);
$service = $_GET["service"]; // ID del servizio/trustAnchor da usare. es: CIE
$env = ($config["demoEnv"] || $config["developEnv"]) ? "PREPROD" : "PROD"; // ID dell'ambiente da usare. es: PROD
$provider_id = $_GET["provider_id"]; // client_id del provider scelto
$baseRequest = Authorize::BuildAuthzBaseRequest(
["https://www.spid.gov.it/SpidL1"], // Livello SPID o ACR
[
"userinfo" => [ // Claims richiesti
"given_name" => [
"essential" => true
],
"family_name" => [
"essential" => true
],
"https://attributes.eid.gov.it/fiscal_number" => [
"essential" => true
],
]
],
["openid",], // Tipo di login
["consent", "login"]
);
try {
Authorize::sendAuthorizationRequest($service, $env, $provider_id, $baseRequest);
$_SESSION["publicSSOSource"] = ($service == "CIE") ? "CIE" : "SPID";
} catch (FlowException $fex) {
// Le FlowException sono eccezioni gestite da oidc-client che hanno un messaggio
// abbastanza friendly per l'utente
die($fex->getMessage());
} catch (\Throwable $t) {
// Il resto delle eccezioni invece è inatteso e andrebbe gestito separatamente
throw $t;
}