From d9330486e9fe36a179d2d0a1e01e608fecff0558 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 4 Nov 2016 17:27:36 +0100 Subject: [PATCH] Replace ExternalBackend::getRemoteUserEnvvars() with an attribute refs #12164 --- .../Config/UserBackend/ExternalBackendForm.php | 2 +- .../Authentication/User/ExternalBackend.php | 17 +++++++---------- .../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 e21ed426f..61303b0f3 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 98a180788..65ec1029a 100644 --- a/library/Icinga/Authentication/User/ExternalBackend.php +++ b/library/Icinga/Authentication/User/ExternalBackend.php @@ -11,6 +11,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 * @@ -83,16 +90,6 @@ class ExternalBackend implements UserBackendInterface return null; } - /** - * Get possible variables where to read the user from - * - * @return string[] - */ - public static function getRemoteUserEnvvars() - { - return array('REDIRECT_REMOTE_USER', 'REMOTE_USER'); - } - /** * {@inheritdoc} */ diff --git a/modules/setup/application/forms/AuthenticationPage.php b/modules/setup/application/forms/AuthenticationPage.php index 8fb397edc..97356cab8 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;