Skip to content

Commit a57bb00

Browse files
committed
[Security] Return null instead of empty username to fix deprecation notice
1 parent 54f2ccc commit a57bb00

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Authenticator/RemoteUserAuthenticator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ protected function extractUsername(Request $request): ?string
4545
throw new BadCredentialsException(sprintf('User key was not found: "%s".', $this->userKey));
4646
}
4747

48-
return $request->server->get($this->userKey);
48+
return $request->server->get($this->userKey) ?: null;
4949
}
5050
}

Tests/Authenticator/RemoteUserAuthenticatorTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function testSupportNoUser()
3636
$authenticator = new RemoteUserAuthenticator(new InMemoryUserProvider(), new TokenStorage(), 'main');
3737

3838
$this->assertFalse($authenticator->supports($this->createRequest([])));
39+
$this->assertFalse($authenticator->supports($this->createRequest(['REMOTE_USER' => ''])));
3940
}
4041

4142
public function testSupportTokenStorageWithToken()

0 commit comments

Comments
 (0)