Skip to content

Commit 3f60598

Browse files
SofHadfabpot
authored andcommitted
[Security] add USERNAME_NONE_PROVIDED constant
1 parent 0974606 commit 3f60598

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
*/
2525
interface AuthenticationProviderInterface extends AuthenticationManagerInterface
2626
{
27+
/**
28+
* Use this constant for not provided username
29+
*
30+
* @var string
31+
*/
32+
const USERNAME_NONE_PROVIDED = 'NONE_PROVIDED';
33+
2734
/**
2835
* Checks whether this provider supports the given token.
2936
*

src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(UserProviderInterface $userProvider, UserCheckerInte
5858
*/
5959
protected function retrieveUser($username, UsernamePasswordToken $token)
6060
{
61-
if ('NONE_PROVIDED' === $username) {
61+
if (AuthenticationProviderInterface::USERNAME_NONE_PROVIDED === $username) {
6262
throw new UsernameNotFoundException('Username can not be null');
6363
}
6464

src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function authenticate(TokenInterface $token)
6363

6464
$username = $token->getUsername();
6565
if ('' === $username || null === $username) {
66-
$username = 'NONE_PROVIDED';
66+
$username = AuthenticationProviderInterface::USERNAME_NONE_PROVIDED;
6767
}
6868

6969
try {

0 commit comments

Comments
 (0)