[icinga-checkins] icinga.org: icingaweb2/bugfix/evaluate-redirect_remote_user-12164: ExternalBackend::getRemoteUser(): restore previous default behavior

git at icinga.org git at icinga.org
Tue Oct 18 10:24:23 CEST 2016


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

Author: Alexander A. Klimov <alexander.klimov at icinga.com>
Date:   Tue Oct 18 10:22:06 2016 +0200

ExternalBackend::getRemoteUser(): restore previous default behavior

refs #12164

---

 .../Icinga/Authentication/User/ExternalBackend.php |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/library/Icinga/Authentication/User/ExternalBackend.php b/library/Icinga/Authentication/User/ExternalBackend.php
index 38cc27b..44cd85e 100644
--- a/library/Icinga/Authentication/User/ExternalBackend.php
+++ b/library/Icinga/Authentication/User/ExternalBackend.php
@@ -67,16 +67,18 @@ class ExternalBackend implements UserBackendInterface
      *
      * @return  string|null
      */
-    public static function getRemoteUser($variable = 'REMOTE_USER')
+    public static function getRemoteUser($variable = null)
     {
-        foreach (($variable === null ? array('REMOTE_USER', 'REDIRECT_REMOTE_USER') : array($variable)) as $variable) {
-            $username = getenv($variable);
-            if ($username !== false) {
-                return $username;
-            }
-            if (array_key_exists($variable, $_SERVER)) {
-                return $_SERVER[$variable];
-            }
+        if ($variable === null) {
+            $variable = 'REMOTE_USER';
+        }
+
+        $username = getenv($variable);
+        if ($username !== false) {
+            return $username;
+        }
+        if (array_key_exists($variable, $_SERVER)) {
+            return $_SERVER[$variable];
         }
         return null;
     }



More information about the icinga-checkins mailing list