ExternalBackendForm: Remove option to configure where to fetch a remote user

refs #12164
This commit is contained in:
Johannes Meyer 2016-11-16 12:06:58 +01:00
parent 3a816ce0f7
commit 2c817215cb
3 changed files with 3 additions and 35 deletions

View File

@ -3,7 +3,6 @@
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;
@ -56,31 +55,6 @@ class ExternalBackendForm extends Form
'validators' => array($callbackValidator) 'validators' => array($callbackValidator)
) )
); );
$hasRemoteUser = false;
foreach (ExternalBackend::$remoteUserEnvvars as $envvar) {
if (ExternalBackend::getRemoteUser($envvar) !== null) {
$hasRemoteUser = true;
break;
}
}
if (! $hasRemoteUser) {
$envvar = 'REMOTE_USER';
}
$this->addElement(
'text',
'username_envvar',
array(
'label' => $this->translate('Username Environment Variable'),
'description' => $this->translate(
'The environment variable the webserver assigns the authenticated user\'s name to.'
),
'required' => true,
'value' => $envvar
)
);
$this->addElement( $this->addElement(
'hidden', 'hidden',
'backend', 'backend',

View File

@ -270,7 +270,7 @@ class AdminAccountPage extends Form
*/ */
protected function getUsername() protected function getUsername()
{ {
$name = ExternalBackend::getRemoteUser($this->backendConfig['username_envvar']); list($name, $_) = ExternalBackend::getRemoteUserInformation();
if ($name === null) { if ($name === null) {
return ''; return '';
} }

View File

@ -32,14 +32,8 @@ class AuthenticationPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
if (isset($formData['type']) && $formData['type'] === 'external') { if (isset($formData['type']) && $formData['type'] === 'external') {
$hasRemoteUser = false; list($username, $_) = ExternalBackend::getRemoteUserInformation();
foreach (ExternalBackend::$remoteUserEnvvars as $envvar) { if ($username === null) {
if (ExternalBackend::getRemoteUser($envvar) !== null) {
$hasRemoteUser = true;
break;
}
}
if (! $hasRemoteUser) {
$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 '