ExternalBackendForm: suggest REDIRECT_REMOTE_USER as username variable if set
refs #12164
This commit is contained in:
parent
790d83cb72
commit
be4a31c8e1
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
namespace Icinga\Forms\Config\UserBackend;
|
namespace Icinga\Forms\Config\UserBackend;
|
||||||
|
|
||||||
|
use Icinga\Authentication\User\ExternalBackend;
|
||||||
use Zend_Validate_Callback;
|
use Zend_Validate_Callback;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
|
||||||
|
@ -55,6 +56,12 @@ class ExternalBackendForm extends Form
|
||||||
'validators' => array($callbackValidator)
|
'validators' => array($callbackValidator)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
foreach (array('REDIRECT_REMOTE_USER', 'REMOTE_USER') as $envvar) {
|
||||||
|
if (ExternalBackend::getRemoteUser($envvar) !== null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'text',
|
'text',
|
||||||
'username_envvar',
|
'username_envvar',
|
||||||
|
@ -64,9 +71,10 @@ class ExternalBackendForm extends Form
|
||||||
'The environment variable the webserver assigns the authenticated user\'s name to.'
|
'The environment variable the webserver assigns the authenticated user\'s name to.'
|
||||||
),
|
),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'value' => 'REMOTE_USER'
|
'value' => $envvar
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'hidden',
|
'hidden',
|
||||||
'backend',
|
'backend',
|
||||||
|
|
Loading…
Reference in New Issue