37 include_once (
'WHAT/Lib.Common.php');
39 if ($authtype ==
"")
throw new Dcp\Exception(__METHOD__ .
" " .
"Error: authentication mode not set");
40 if ($authprovider ==
"")
throw new Dcp\Exception(__METHOD__ .
" " .
"Error: authentication provider not set");
44 'provider' => $authprovider
47 if ($authprovider != self::nullProvider) {
49 $this->parms = array_merge($tx, $ta, $tp);
51 if (!array_key_exists(
'provider', $this->parms)) {
52 throw new Dcp\Exception(__METHOD__ .
" " .
"Error: provider parm not specified at __construct");
54 $providerClass = $this->parms{
'provider'} .
'Provider';
56 $classFile =
'WHAT/Class.' . $providerClass .
'.php';
57 $ret = file_exists($classFile);
59 throw new Dcp\Exception(__METHOD__ .
" " .
"Error: ." . $classFile .
" not found");
61 include_once ($classFile);
62 if (!class_exists($providerClass)) {
63 throw new Dcp\Exception(__METHOD__ .
" " .
"Error: " . $providerClass .
" class not found");
66 $this->provider =
new $providerClass($authprovider, $this->parms);
67 if (!is_a($this->provider,
'Provider')) {
68 throw new Dcp\Exception(__METHOD__ .
" " . sprintf(
"Error: provider with class '%s' does not inherits from class 'Provider'.", $providerClass));
71 $this->parms = array_merge($tx, $ta);
78 if (!is_array($freedom_providers)) {
82 if (!array_key_exists(
$provider, $freedom_providers)) {
83 error_log(__FUNCTION__ .
":" . __LINE__ .
"provider " .
$provider .
" does not exists in freedom_providers");
93 if (!is_array($freedom_authtypeparams)) {
106 include_once (
'FDL/Class.Doc.php');
107 include_once (
'WHAT/Class.User.php');
110 if ($u->SetLoginName($username)) {
113 if ($du->isAlive()) {
122 if (!$this->provider->canICreateUser()) {
123 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Authentication failed for user '%s' because auto-creation is disabled for provider '%s'!", $username, $this->provider->pname));
126 $err = $this->provider->initializeUser($username);
128 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Error creating user '%s' err=[%s]", $username,
$err));
131 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Initialized user '%s'!", $username));
137 if ($this->provider) {
138 return $this->provider->errno;
145 if (isset($this->parms[
'auth'][
'app'])) {
146 return $this->parms[
'auth'][
'app'];
156 abstract function logout($redir_uri =
'');
if(substr($wsh, 0, 1)!= '/') $args
getDbAccessValue($varName)
Exception class use exceptionCode to identifiy correctly exception.
static getAuthParam($provider="")
__construct($authtype, $authprovider)
tryInitializeUser($username)
getAuthParam($freedomctx="", $provider="")
setSessionVar($name, $value)
getAuthTypeParams($freedomctx="")
static getAuthTypeParams()
new_Doc($dbaccess, $id= '', $latest=false)
static freedomUserExists($username)
if($file) if($subject==""&&$file) if($subject=="") $err