33 include_once (
'WHAT/Lib.Common.php');
35 if (
$authtype ==
"")
throw new Exception(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: authentication mode not set");
36 if ($authprovider ==
"")
throw new Exception(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: authentication provider not set");
40 'provider' => $authprovider
43 if ($authprovider !=
"__for_logout__") {
45 $this->parms = array_merge($tx,
$ta, $tp);
47 if (!array_key_exists(
'provider', $this->parms)) {
48 throw new Exception(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: provider parm not specified at __construct");
50 $providerClass = $this->parms{
'provider'} .
'Provider';
51 $ret = @include_once (
'WHAT/Class.' . $providerClass .
'.php');
53 throw new Exception(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: WHAT/Class." . $providerClass .
".php not found");
55 if (!class_exists($providerClass)) {
56 throw new Exception(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: " . $providerClass .
" class not found");
60 $this->provider =
new $providerClass($authprovider, $this->parms);
62 $this->parms = array_merge($tx,
$ta);
68 @include_once (
'FDL/Class.Doc.php');
69 @include_once (
'WHAT/Class.User.php');
72 if (
$u->SetLoginName($username)) {
84 if (!$this->provider->canICreateUser()) {
85 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Authentication failed for user '%s' because auto-creation is disabled for provider '%s'!", $username, $this->provider->pname));
88 $err = $this->provider->initializeUser($username);
90 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Error creating user '%s' err=[%s]", $username,
$err));
93 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Initialized user '%s'!", $username));
99 if ($this->provider) {
100 return $this->provider->errno;
110 abstract function logout($redir_uri);