20 include_once (
'WHAT/Class.Authenticator.php');
28 if (array_key_exists(
'logout', $_COOKIE) && $_COOKIE[
'logout'] ==
"true") {
29 setcookie(
'logout',
'', time() - 3600);
33 if (!array_key_exists(
'PHP_AUTH_USER',
$_SERVER)) {
34 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: undefined _SERVER[PHP_AUTH_USER]");
38 if (!array_key_exists(
'PHP_AUTH_PW',
$_SERVER)) {
39 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: undefined _SERVER[PHP_AUTH_PW] for user " .
$_SERVER[
'PHP_AUTH_USER']);
43 if (!is_callable(array(
47 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: " . $this->parms{
'type'} . $this->parms{
'provider'} .
"Provider must implement validateCredential()");
51 if (!$this->provider->validateCredential(
$_SERVER[
'PHP_AUTH_USER'],
$_SERVER[
'PHP_AUTH_PW'])) {
66 if (is_callable(array(
70 return $this->provider->checkAuthorization($opt);
78 if (is_callable(array(
82 return $this->provider->askAuthentication();
84 header(
'HTTP/1.1 401 Authentication Required');
85 header(
'WWW-Authenticate: Basic realm="' . $this->parms{
'realm'} .
'"');
86 header(
'Connection: close');
92 if (is_callable(array(
96 return $this->provider->getAuthUser();
104 if (is_callable(array(
108 return $this->provider->getAuthPw();
116 setcookie(
'logout',
'true', 0);
117 if ($redir_uri ==
'') {
118 $redir_uri =
getParam(
'CORE_BASEURL');
120 header(
'Location: ' . $redir_uri);