351,6 → 351,7 |
} |
|
protected function authentifier() { |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
if (!isset($_SERVER['PHP_AUTH_USER'])) { |
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"'); |
header('HTTP/1.0 401 Unauthorized'); |
369,8 → 370,10 |
} |
} |
} |
} |
|
protected function verifierAcces($id = null, $mdp = null) { |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
$id = is_null($id) ? $_SERVER['PHP_AUTH_USER'] : $id; |
$mdp = is_null($mdp) ? $_SERVER['PHP_AUTH_PW'] : $mdp; |
|
386,7 → 389,10 |
$identifie = true; |
} |
return $identifie; |
} else { |
return true; // ça fait un peu mal... |
} |
} |
|
/** |
* Envoie une demande d'authentification HTTP puis compare le couple |
398,9 → 404,11 |
protected function authentificationHttpSimple() { |
$autorise = true; |
// contrôle d'accès |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
$nomUtil = $_SERVER['PHP_AUTH_USER']; |
$mdp = $_SERVER['PHP_AUTH_PW']; |
$autorise = (($nomUtil == $this->config['database_ident']['username']) && ($mdp == $this->config['database_ident']['password'])); |
} |
// entêtes HTTP |
if (! $autorise) { |
header('WWW-Authenticate: Basic realm="Annuaire de Tela Botanica"'); |