Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2845 → Rev 2846

/trunk/jrest/bibliotheque/GestionUtilisateur.php
93,12 → 93,50
$login = false;
if($token) {
// On demande à l'annuaire si le jeton est bien valide
$valide = file_get_contents($this->config['identification']['sso_url'].'/verifierjeton?token='.$token);
 
// curl avec les options suivantes ignore le pb de certificat (pour tester en local)
// @TODO CHANGER !
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $this->config['identification']['sso_url'].'/verifierjeton?token='.$token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// équivalent de "-k"
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$valide = curl_exec($ch);
curl_close($ch);
 
//$valide = file_get_contents($this->config['identification']['sso_url'].'/verifierjeton?token='.$token);
$login = ($valide === "true") ? $this->obtenirLoginParToken($token) : false;
}
return $login;
}
protected function verifierJeton($jeton) {
$urlServiceVerification = $this->conteneur->getParametre("urlServiceBaseAuth") . "verifierjeton";
$urlServiceVerification .= "?token=" . $jeton;
 
// file_get_contents râle si le certificat HTTPS est auto-signé
//$retour = file_get_contents($urlServiceVerification);
 
// curl avec les options suivantes ignore le pb de certificat (pour tester en local)
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $urlServiceVerification);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// équivalent de "-k"
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
curl_close($ch);
$retour = $data;
 
$retour = json_decode($retour, true);
 
return ($retour === true);
}
private function decoderToken($token) {
$token_parts = explode('.', $token);