Skip to content

Commit a8516b7

Browse files
committed
[Security] Return null instead of empty username to fix deprecation notice
1 parent 7e396bb commit a8516b7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Security/Http/Authenticator/RemoteUserAuthenticator.php

Lines changed: 1 addition & 1 deletion
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
}

src/Symfony/Component/Security/Http/Tests/Authenticator/RemoteUserAuthenticatorTest.php

Lines changed: 1 addition & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy