Use getenv() instead of $_SERVER to get REMOTE_USER

refs #10488
This commit is contained in:
Alexander A. Klimov 2015-12-18 13:26:38 +01:00
parent 414a78d532
commit fc8873ec0a
3 changed files with 5 additions and 5 deletions

View File

@ -58,8 +58,8 @@ class ExternalBackend implements UserBackendInterface
*/
public function authenticate(User $user, $password = null)
{
if (isset($_SERVER['REMOTE_USER'])) {
$username = $_SERVER['REMOTE_USER'];
$username = getenv('REMOTE_USER');
if ($username !== false) {
$user->setExternalUserInformation($username, 'REMOTE_USER');
if ($this->stripUsernameRegexp) {

View File

@ -269,11 +269,11 @@ class AdminAccountPage extends Form
*/
protected function getUsername()
{
if (false === isset($_SERVER['REMOTE_USER'])) {
$name = getenv('REMOTE_USER');
if ($name === false) {
return '';
}
$name = $_SERVER['REMOTE_USER'];
if (isset($this->backendConfig['strip_username_regexp']) && $this->backendConfig['strip_username_regexp']) {
// No need to silence or log anything here because the pattern has
// already been successfully compiled during backend configuration

View File

@ -30,7 +30,7 @@ class AuthenticationPage extends Form
*/
public function createElements(array $formData)
{
if (isset($formData['type']) && $formData['type'] === 'external' && !isset($_SERVER['REMOTE_USER'])) {
if (isset($formData['type']) && $formData['type'] === 'external' && getenv('REMOTE_USER') === false) {
$this->info(
$this->translate(
'You\'re currently not authenticated using any of the web server\'s authentication '