[icinga-checkins] icinga.org: icingaweb2/master: Replace ExternalBackend:: getRemoteUserEnvvars() with an attribute

git at icinga.org git at icinga.org
Mon Nov 21 08:53:51 CET 2016


Module: icingaweb2
Branch: master
Commit: d9330486e9fe36a179d2d0a1e01e608fecff0558
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=d9330486e9fe36a179d2d0a1e01e608fecff0558

Author: Alexander A. Klimov <alexander.klimov at icinga.com>
Date:   Fri Nov  4 17:27:36 2016 +0100

Replace ExternalBackend::getRemoteUserEnvvars() with an attribute

refs #12164

---

 .../forms/Config/UserBackend/ExternalBackendForm.php  |    2 +-
 .../Icinga/Authentication/User/ExternalBackend.php    |   17 +++++++----------
 .../setup/application/forms/AuthenticationPage.php    |    2 +-
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/application/forms/Config/UserBackend/ExternalBackendForm.php b/application/forms/Config/UserBackend/ExternalBackendForm.php
index e21ed42..61303b0 100644
--- a/application/forms/Config/UserBackend/ExternalBackendForm.php
+++ b/application/forms/Config/UserBackend/ExternalBackendForm.php
@@ -57,7 +57,7 @@ class ExternalBackendForm extends Form
             )
         );
 
-        foreach (ExternalBackend::getRemoteUserEnvvars() as $envvar) {
+        foreach (ExternalBackend::$remoteUserEnvvars as $envvar) {
             if (ExternalBackend::getRemoteUser($envvar) !== null) {
                 break;
             }
diff --git a/library/Icinga/Authentication/User/ExternalBackend.php b/library/Icinga/Authentication/User/ExternalBackend.php
index 98a1807..65ec102 100644
--- a/library/Icinga/Authentication/User/ExternalBackend.php
+++ b/library/Icinga/Authentication/User/ExternalBackend.php
@@ -12,6 +12,13 @@ use Icinga\User;
 class ExternalBackend implements UserBackendInterface
 {
     /**
+     * Possible variables where to read the user from
+     *
+     * @var string[]
+     */
+    public static $remoteUserEnvvars = array('REDIRECT_REMOTE_USER', 'REMOTE_USER');
+
+    /**
      * The name of this backend
      *
      * @var string
@@ -84,16 +91,6 @@ class ExternalBackend implements UserBackendInterface
     }
 
     /**
-     * Get possible variables where to read the user from
-     *
-     * @return  string[]
-     */
-    public static function getRemoteUserEnvvars()
-    {
-        return array('REDIRECT_REMOTE_USER', 'REMOTE_USER');
-    }
-
-    /**
      * {@inheritdoc}
      */
     public function authenticate(User $user, $password = null)
diff --git a/modules/setup/application/forms/AuthenticationPage.php b/modules/setup/application/forms/AuthenticationPage.php
index 8fb397e..97356ca 100644
--- a/modules/setup/application/forms/AuthenticationPage.php
+++ b/modules/setup/application/forms/AuthenticationPage.php
@@ -33,7 +33,7 @@ class AuthenticationPage extends Form
     {
         if (isset($formData['type']) && $formData['type'] === 'external') {
             $hasRemoteUser = false;
-            foreach (ExternalBackend::getRemoteUserEnvvars() as $envvar) {
+            foreach (ExternalBackend::$remoteUserEnvvars as $envvar) {
                 if (ExternalBackend::getRemoteUser($envvar) !== null) {
                     $hasRemoteUser = true;
                     break;



More information about the icinga-checkins mailing list