Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a8516b7

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

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Authenticator/RemoteUserAuthenticator.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Authenticator/RemoteUserAuthenticatorTest.php
+1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.