summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSofHad <sofiane.haddag@yahoo.fr>2015-11-23 12:12:59 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2016-01-25 13:06:55 +0100
commitd7ed0875e79cac58708a75b06966e8c047de036b (patch)
tree7a69e84f69091fd7c47a77b21d1eeafad2635340
parentabb8622418022b6877b6399120cbec5d244e6631 (diff)
downloadsymfony-security-d7ed0875e79cac58708a75b06966e8c047de036b.zip
symfony-security-d7ed0875e79cac58708a75b06966e8c047de036b.tar.gz
symfony-security-d7ed0875e79cac58708a75b06966e8c047de036b.tar.bz2
[Security] add USERNAME_NONE_PROVIDED constant
-rw-r--r--Core/Authentication/Provider/AuthenticationProviderInterface.php7
-rw-r--r--Core/Authentication/Provider/LdapBindAuthenticationProvider.php2
-rw-r--r--Core/Authentication/Provider/UserAuthenticationProvider.php2
3 files changed, 9 insertions, 2 deletions
diff --git a/Core/Authentication/Provider/AuthenticationProviderInterface.php b/Core/Authentication/Provider/AuthenticationProviderInterface.php
index adad258..eaf9e07 100644
--- a/Core/Authentication/Provider/AuthenticationProviderInterface.php
+++ b/Core/Authentication/Provider/AuthenticationProviderInterface.php
@@ -25,6 +25,13 @@ use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterfac
interface AuthenticationProviderInterface extends AuthenticationManagerInterface
{
/**
+ * Use this constant for not provided username
+ *
+ * @var string
+ */
+ const USERNAME_NONE_PROVIDED = 'NONE_PROVIDED';
+
+ /**
* Checks whether this provider supports the given token.
*
* @param TokenInterface $token A TokenInterface instance
diff --git a/Core/Authentication/Provider/LdapBindAuthenticationProvider.php b/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
index adc42ef..7283ab9 100644
--- a/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
+++ b/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
@@ -58,7 +58,7 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider
*/
protected function retrieveUser($username, UsernamePasswordToken $token)
{
- if ('NONE_PROVIDED' === $username) {
+ if (AuthenticationProviderInterface::USERNAME_NONE_PROVIDED === $username) {
throw new UsernameNotFoundException('Username can not be null');
}
diff --git a/Core/Authentication/Provider/UserAuthenticationProvider.php b/Core/Authentication/Provider/UserAuthenticationProvider.php
index 2674088..9dc4751 100644
--- a/Core/Authentication/Provider/UserAuthenticationProvider.php
+++ b/Core/Authentication/Provider/UserAuthenticationProvider.php
@@ -63,7 +63,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
$username = $token->getUsername();
if ('' === $username || null === $username) {
- $username = 'NONE_PROVIDED';
+ $username = AuthenticationProviderInterface::USERNAME_NONE_PROVIDED;
}
try {