diff options
author | Andrew Dolgov <[email protected]> | 2021-01-05 10:37:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-01-05 10:37:30 +0300 |
commit | 8a34084df101a8511b4be4adc4c489baae3bcfce (patch) | |
tree | 01dc52a520c69a38c18b65468fa94fa44def37c1 /plugins/auth_remote/init.php | |
parent | 4e3ef7a4dd391f219be4ca6b5486b30b9dec1618 (diff) |
auth_remote: rewrite header checking to be more readable
Diffstat (limited to 'plugins/auth_remote/init.php')
-rw-r--r-- | plugins/auth_remote/init.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index d2e7a35e6..343758b60 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -41,12 +41,14 @@ class Auth_Remote extends Plugin implements IAuthModule { * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ function authenticate($login, $password) { - $try_login = $_SERVER["REMOTE_USER"]; - if (!$try_login) $try_login = $_SERVER["HTTP_REMOTE_USER"]; + $try_login = ""; - // php-cgi - if (!$try_login) $try_login = $_SERVER["REDIRECT_REMOTE_USER"]; - if (!$try_login) $try_login = $_SERVER["PHP_AUTH_USER"]; + foreach (["REMOTE_USER", "HTTP_REMOTE_USER", "REDIRECT_REMOTE_USER", "PHP_AUTH_USER"] as $hdr) { + if (isset($_SERVER[$hdr])) { + $try_login = $_SERVER["hdr"]; + break; + } + } if (!$try_login) $try_login = $this->get_login_by_ssl_certificate(); |