setup/AuthenticationPage: don't show the warning about external backend configuration if REDIRECT_REMOTE_USER is set
refs #12164
This commit is contained in:
parent
be4a31c8e1
commit
d6ac6c8374
|
@ -57,7 +57,7 @@ class ExternalBackendForm extends Form
|
|||
)
|
||||
);
|
||||
|
||||
foreach (array('REDIRECT_REMOTE_USER', 'REMOTE_USER') as $envvar) {
|
||||
foreach (ExternalBackend::getRemoteUserEnvvars() as $envvar) {
|
||||
if (ExternalBackend::getRemoteUser($envvar) !== null) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,15 @@ class ExternalBackend implements UserBackendInterface
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get possible variables where to read the user from
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getRemoteUserEnvvars()
|
||||
{
|
||||
return array('REDIRECT_REMOTE_USER', 'REMOTE_USER');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -31,16 +31,24 @@ class AuthenticationPage extends Form
|
|||
*/
|
||||
public function createElements(array $formData)
|
||||
{
|
||||
if (isset($formData['type']) && $formData['type'] === 'external'
|
||||
&& ExternalBackend::getRemoteUser(null) === null) {
|
||||
$this->info(
|
||||
$this->translate(
|
||||
'You\'re currently not authenticated using any of the web server\'s authentication '
|
||||
. 'mechanisms. Make sure you\'ll configure such, otherwise you\'ll not be able to '
|
||||
. 'log into Icinga Web 2.'
|
||||
),
|
||||
false
|
||||
);
|
||||
if (isset($formData['type']) && $formData['type'] === 'external') {
|
||||
$hasRemoteUser = false;
|
||||
foreach (ExternalBackend::getRemoteUserEnvvars() as $envvar) {
|
||||
if (ExternalBackend::getRemoteUser($envvar) !== null) {
|
||||
$hasRemoteUser = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! $hasRemoteUser) {
|
||||
$this->info(
|
||||
$this->translate(
|
||||
'You\'re currently not authenticated using any of the web server\'s authentication '
|
||||
. 'mechanisms. Make sure you\'ll configure such, otherwise you\'ll not be able to '
|
||||
. 'log into Icinga Web 2.'
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$backendTypes = array();
|
||||
|
|
Loading…
Reference in New Issue