Merge branch 'feature/use-_env-variables-with-built-in-php-webserver-10488'

resolves #10488
This commit is contained in:
Eric Lippmann 2015-12-21 10:46:05 +01:00
commit 720e022bea
4 changed files with 7 additions and 8 deletions

View File

@ -138,9 +138,8 @@ abstract class ApplicationBootstrap
$this->setupAutoloader(); $this->setupAutoloader();
if ($configDir === null) { if ($configDir === null) {
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) { $configDir = getenv('ICINGAWEB_CONFIGDIR');
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR']; if ($configDir === false) {
} else {
$configDir = Platform::isWindows() $configDir = Platform::isWindows()
? $baseDir . '/config' ? $baseDir . '/config'
: '/etc/icingaweb2'; : '/etc/icingaweb2';

View File

@ -58,8 +58,8 @@ class ExternalBackend implements UserBackendInterface
*/ */
public function authenticate(User $user, $password = null) public function authenticate(User $user, $password = null)
{ {
if (isset($_SERVER['REMOTE_USER'])) { $username = getenv('REMOTE_USER');
$username = $_SERVER['REMOTE_USER']; if ($username !== false) {
$user->setExternalUserInformation($username, 'REMOTE_USER'); $user->setExternalUserInformation($username, 'REMOTE_USER');
if ($this->stripUsernameRegexp) { if ($this->stripUsernameRegexp) {

View File

@ -269,11 +269,11 @@ class AdminAccountPage extends Form
*/ */
protected function getUsername() protected function getUsername()
{ {
if (false === isset($_SERVER['REMOTE_USER'])) { $name = getenv('REMOTE_USER');
if ($name === false) {
return ''; return '';
} }
$name = $_SERVER['REMOTE_USER'];
if (isset($this->backendConfig['strip_username_regexp']) && $this->backendConfig['strip_username_regexp']) { if (isset($this->backendConfig['strip_username_regexp']) && $this->backendConfig['strip_username_regexp']) {
// No need to silence or log anything here because the pattern has // No need to silence or log anything here because the pattern has
// already been successfully compiled during backend configuration // already been successfully compiled during backend configuration

View File

@ -30,7 +30,7 @@ class AuthenticationPage extends Form
*/ */
public function createElements(array $formData) public function createElements(array $formData)
{ {
if (isset($formData['type']) && $formData['type'] === 'external' && !isset($_SERVER['REMOTE_USER'])) { if (isset($formData['type']) && $formData['type'] === 'external' && getenv('REMOTE_USER') === false) {
$this->info( $this->info(
$this->translate( $this->translate(
'You\'re currently not authenticated using any of the web server\'s authentication ' 'You\'re currently not authenticated using any of the web server\'s authentication '