Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3968 → Rev 3969

/trunk/widget/bibliotheque/WidgetCommun.php
180,7 → 180,7
}
 
protected function getUserFromCookie(){
$cookie = $_COOKIE['tb_auth'];
$cookie = $_COOKIE[$this->config['authentification']['cookieName']];
if ($cookie){
// Récupération de l'id et email de l'utilisateur connecté
187,11 → 187,6
$tokenInfos = $this->decodeToken($cookie);
$token = $this->refreshToken($cookie)['token'];
// $service = "auth/identite?token=";
// $url = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service).$cookie;
//
// $json = $this->getDao()->consulter($url);
// $token = json_decode($json, true)['token'];
 
$user = [
'id' => $tokenInfos['id'],
205,13 → 200,12
}
protected function refreshToken($token) {
// $verificationServiceURL = 'https://www.tela-botanica.org/service:annuaire:auth/identite';
$service = "auth/identite?token=" . $token;
$verificationServiceURL = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service);
// $verificationServiceURL .= "?token=" . $token;
 
$ch = curl_init();
// $timeout = 5;
$cookie = 'tb_auth='.$token;
 
$cookie = $this->config['authentification']['cookieName'].'='.$token;
$headr = array();
$headr[] = 'Cookie: ' . $cookie;
225,18 → 219,12
// ]);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
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);
$response = curl_exec($ch);
// if ($response === false) {
// echo 'Erreur cURL : ' . curl_error($ch);
// } else {
// echo 'Réponse : ' . $response;
// }
curl_close($ch);
 
return json_decode($response, true);