Bootstrap/Web: Only load authentication.ini if needed

fixes #6238
This commit is contained in:
Marius Hein 2014-06-03 14:14:30 +02:00
parent 274fc58d0f
commit 160a95e32d
1 changed files with 10 additions and 6 deletions

View File

@ -201,13 +201,19 @@ class Web extends ApplicationBootstrap
}
/**
* Create user object and inject preference interface
* Create user object
*
* @return self
* @throws ConfigurationError
*/
private function setupUser()
{
$authenticationManager = AuthenticationManager::getInstance();
if ($authenticationManager->isAuthenticated() === true) {
$this->user = $authenticationManager->getUser();
return $this;
}
try {
$config = Config::app('authentication');
} catch (NotReadableError $e) {
@ -216,15 +222,13 @@ class Web extends ApplicationBootstrap
);
$config = null;
}
$authenticationManager = AuthenticationManager::getInstance($config);
if ($config !== null && $config->global !== null &&
$config->global->get('authenticationMode', 'internal') === 'external'
) {
$authenticationManager->authenticateFromRemoteUser();
}
if ($authenticationManager->isAuthenticated() === true) {
$this->user = $authenticationManager->getUser();
}
return $this;
}