[icinga-checkins] icinga.org: icingaweb2/bugfix/evaluate-redirect_remote_user-12164: ExternalBackendForm: suggest REDIRECT_REMOTE_USER as username variable if set

git at icinga.org git at icinga.org
Tue Oct 18 15:39:46 CEST 2016


Module: icingaweb2
Branch: bugfix/evaluate-redirect_remote_user-12164
Commit: be4a31c8e19db2bc51932d8d6c69b31f1ae7fb32
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=be4a31c8e19db2bc51932d8d6c69b31f1ae7fb32

Author: Alexander A. Klimov <alexander.klimov at icinga.com>
Date:   Tue Oct 18 15:05:57 2016 +0200

ExternalBackendForm: suggest REDIRECT_REMOTE_USER as username variable if set

refs #12164

---

 application/forms/Config/UserBackend/ExternalBackendForm.php |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/application/forms/Config/UserBackend/ExternalBackendForm.php b/application/forms/Config/UserBackend/ExternalBackendForm.php
index 39c46d9..34519e6 100644
--- a/application/forms/Config/UserBackend/ExternalBackendForm.php
+++ b/application/forms/Config/UserBackend/ExternalBackendForm.php
@@ -3,6 +3,7 @@
 
 namespace Icinga\Forms\Config\UserBackend;
 
+use Icinga\Authentication\User\ExternalBackend;
 use Zend_Validate_Callback;
 use Icinga\Web\Form;
 
@@ -55,6 +56,12 @@ class ExternalBackendForm extends Form
                 'validators'    => array($callbackValidator)
             )
         );
+
+        foreach (array('REDIRECT_REMOTE_USER', 'REMOTE_USER') as $envvar) {
+            if (ExternalBackend::getRemoteUser($envvar) !== null) {
+                break;
+            }
+        }
         $this->addElement(
             'text',
             'username_envvar',
@@ -64,9 +71,10 @@ class ExternalBackendForm extends Form
                     'The environment variable the webserver assigns the authenticated user\'s name to.'
                 ),
                 'required'      => true,
-                'value'         => 'REMOTE_USER'
+                'value'         => $envvar
             )
         );
+
         $this->addElement(
             'hidden',
             'backend',



More information about the icinga-checkins mailing list