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

View File

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