forked from extern/egroupware
Allow HTTP basic auth user to contain a domain to switch instances, as
it's done in the webgui login (for WebDAV or GroupDAV)
This commit is contained in:
parent
94a123c537
commit
814eb013f1
@ -219,7 +219,7 @@ class egw_session
|
|||||||
$config->value('num_unsuccessful_ip',$GLOBALS['egw_info']['server']['num_unsuccessful_ip']);
|
$config->value('num_unsuccessful_ip',$GLOBALS['egw_info']['server']['num_unsuccessful_ip']);
|
||||||
$config->value('install_id',$GLOBALS['egw_info']['server']['install_id']);
|
$config->value('install_id',$GLOBALS['egw_info']['server']['install_id']);
|
||||||
$config->value('sessions_timeout',$GLOBALS['egw_info']['server']['sessions_timeout']);
|
$config->value('sessions_timeout',$GLOBALS['egw_info']['server']['sessions_timeout']);
|
||||||
$config->value('sessions_app_timeout',$GLOBALS['egw_info']['server']['sessions_app_timeout']);
|
$config->value('max_history',$GLOBALS['egw_info']['server']['max_history']);
|
||||||
$config->save_repository();
|
$config->save_repository();
|
||||||
}
|
}
|
||||||
self::set_cookiedomain();
|
self::set_cookiedomain();
|
||||||
@ -414,6 +414,7 @@ class egw_session
|
|||||||
$this->login .= '@'.$this->account_domain;
|
$this->login .= '@'.$this->account_domain;
|
||||||
}
|
}
|
||||||
$now = time();
|
$now = time();
|
||||||
|
//error_log(__METHOD__."($login,$passwd,$passwd_type,$no_session,$auth_check) account_lid=$this->account_lid, account_domain=$this->account_domain, default_domain={$GLOBALS['egw_info']['server']['default_domain']}, user/domain={$GLOBALS['egw_info']['user']['domain']}");
|
||||||
|
|
||||||
// This is to ensure that we authenticate to the correct domain (might not be default)
|
// This is to ensure that we authenticate to the correct domain (might not be default)
|
||||||
// if no domain is given we use the default domain, so we dont need to re-create everything
|
// if no domain is given we use the default domain, so we dont need to re-create everything
|
||||||
@ -421,6 +422,10 @@ class egw_session
|
|||||||
{
|
{
|
||||||
$GLOBALS['egw_info']['user']['domain'] = $this->account_domain;
|
$GLOBALS['egw_info']['user']['domain'] = $this->account_domain;
|
||||||
}
|
}
|
||||||
|
elseif (!$this->account_domain && $GLOBALS['egw_info']['user']['domain'])
|
||||||
|
{
|
||||||
|
$this->account_domain = $GLOBALS['egw_info']['user']['domain'];
|
||||||
|
}
|
||||||
elseif($this->account_domain != $GLOBALS['egw_info']['user']['domain'])
|
elseif($this->account_domain != $GLOBALS['egw_info']['user']['domain'])
|
||||||
{
|
{
|
||||||
throw new Exception("Wrong domain! '$this->account_domain' != '{$GLOBALS['egw_info']['user']['domain']}'");
|
throw new Exception("Wrong domain! '$this->account_domain' != '{$GLOBALS['egw_info']['user']['domain']}'");
|
||||||
@ -1154,7 +1159,7 @@ class egw_session
|
|||||||
/**
|
/**
|
||||||
* Search the instance matching the request
|
* Search the instance matching the request
|
||||||
*
|
*
|
||||||
* @param string $login on login $_POST['login']
|
* @param string $login on login $_POST['login'], $_SERVER['PHP_AUTH_USER'] or $_SERVER['REMOTE_USER']
|
||||||
* @param string $domain_requested usually $_REQUEST['domain']
|
* @param string $domain_requested usually $_REQUEST['domain']
|
||||||
* @param string &$default_domain usually $default_domain get's set eg. by sitemgr
|
* @param string &$default_domain usually $default_domain get's set eg. by sitemgr
|
||||||
* @param string $server_name usually $_SERVER['SERVER_NAME']
|
* @param string $server_name usually $_SERVER['SERVER_NAME']
|
||||||
|
@ -108,8 +108,9 @@ print_debug('sane environment','messageonly','api');
|
|||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
* Multi-Domain support *
|
* Multi-Domain support *
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
$GLOBALS['egw_info']['user']['domain'] = egw_session::search_instance($_POST['login'],$_REQUEST['domain'],
|
$GLOBALS['egw_info']['user']['domain'] = egw_session::search_instance(
|
||||||
$GLOBALS['egw_info']['server']['default_domain'],$_SERVER['SERVER_NAME'],$GLOBALS['egw_domain']);
|
isset($_POST['login']) ? $_POST['login'] : (isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : $_SERVER['REMOTE_USER']),
|
||||||
|
$_REQUEST['domain'],$GLOBALS['egw_info']['server']['default_domain'],$_SERVER['SERVER_NAME'],$GLOBALS['egw_domain']);
|
||||||
|
|
||||||
$GLOBALS['egw_info']['server']['db_host'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_host'];
|
$GLOBALS['egw_info']['server']['db_host'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_host'];
|
||||||
$GLOBALS['egw_info']['server']['db_port'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_port'];
|
$GLOBALS['egw_info']['server']['db_port'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_port'];
|
||||||
|
Loading…
Reference in New Issue
Block a user