Skip to content

Commit b410114

Browse files
committed
[Security] Deprecate the old authentication mechanisms
1 parent 7d0836b commit b410114

16 files changed

+54
-1
lines changed

Authentication/AuthenticationManagerInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* which process Token authentication.
2020
*
2121
* @author Fabien Potencier <fabien@symfony.com>
22+
*
23+
* @internal since Symfony 5.3
2224
*/
2325
interface AuthenticationManagerInterface
2426
{

Authentication/AuthenticationProviderManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
use Symfony\Component\Security\Core\User\UserInterface;
2525
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
2626

27+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AuthenticationProviderManager::class);
28+
2729
// Help opcache.preload discover always-needed symbols
2830
class_exists(AuthenticationEvents::class);
2931
class_exists(AuthenticationFailureEvent::class);
@@ -35,6 +37,8 @@ class_exists(AuthenticationSuccessEvent::class);
3537
*
3638
* @author Fabien Potencier <fabien@symfony.com>
3739
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
40+
*
41+
* @deprecated since Symfony 5.3, use the new authenticator system instead
3842
*/
3943
class AuthenticationProviderManager implements AuthenticationManagerInterface
4044
{

Authentication/Provider/AnonymousAuthenticationProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1717
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
1818

19+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AnonymousAuthenticationProvider::class);
20+
1921
/**
2022
* AnonymousAuthenticationProvider validates AnonymousToken instances.
2123
*
2224
* @author Fabien Potencier <fabien@symfony.com>
25+
*
26+
* @deprecated since Symfony 5.3, use the new authenticator system instead
2327
*/
2428
class AnonymousAuthenticationProvider implements AuthenticationProviderInterface
2529
{

Authentication/Provider/AuthenticationProviderInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1515
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1616

17+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" interface is deprecated, use the new authenticator system instead.', AuthenticationProviderInterface::class);
18+
1719
/**
1820
* AuthenticationProviderInterface is the interface for all authentication
1921
* providers.
2022
*
2123
* Concrete implementations processes specific Token instances.
2224
*
2325
* @author Fabien Potencier <fabien@symfony.com>
26+
*
27+
* @deprecated since Symfony 5.3, use the new authenticator system instead
2428
*/
2529
interface AuthenticationProviderInterface extends AuthenticationManagerInterface
2630
{

Authentication/Provider/DaoAuthenticationProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
use Symfony\Component\Security\Core\User\UserInterface;
2525
use Symfony\Component\Security\Core\User\UserProviderInterface;
2626

27+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', DaoAuthenticationProvider::class);
28+
2729
/**
2830
* DaoAuthenticationProvider uses a UserProviderInterface to retrieve the user
2931
* for a UsernamePasswordToken.
3032
*
3133
* @author Fabien Potencier <fabien@symfony.com>
34+
*
35+
* @deprecated since Symfony 5.3, use the new authenticator system instead
3236
*/
3337
class DaoAuthenticationProvider extends UserAuthenticationProvider
3438
{

Authentication/Provider/LdapBindAuthenticationProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@
2121
use Symfony\Component\Security\Core\User\UserInterface;
2222
use Symfony\Component\Security\Core\User\UserProviderInterface;
2323

24+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', LdapBindAuthenticationProvider::class);
25+
2426
/**
2527
* LdapBindAuthenticationProvider authenticates a user against an LDAP server.
2628
*
2729
* The only way to check user credentials is to try to connect the user with its
2830
* credentials to the ldap.
2931
*
3032
* @author Charles Sarrazin <charles@sarraz.in>
33+
*
34+
* @deprecated since Symfony 5.3, use the new authenticator system instead
3135
*/
3236
class LdapBindAuthenticationProvider extends UserAuthenticationProvider
3337
{

Authentication/Provider/PreAuthenticatedAuthenticationProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use Symfony\Component\Security\Core\User\UserCheckerInterface;
1919
use Symfony\Component\Security\Core\User\UserProviderInterface;
2020

21+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PreAuthenticatedAuthenticationProvider::class);
22+
2123
/**
2224
* Processes a pre-authenticated authentication request.
2325
*
@@ -27,6 +29,8 @@
2729
* UserNotFoundException, for example.
2830
*
2931
* @author Fabien Potencier <fabien@symfony.com>
32+
*
33+
* @deprecated since Symfony 5.3, use the new authenticator system instead
3034
*/
3135
class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderInterface
3236
{

Authentication/Provider/RememberMeAuthenticationProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
use Symfony\Component\Security\Core\User\UserCheckerInterface;
2020
use Symfony\Component\Security\Core\User\UserInterface;
2121

22+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', RememberMeAuthenticationProvider::class);
23+
24+
/**
25+
* @deprecated since Symfony 5.3, use the new authenticator system instead
26+
*/
2227
class RememberMeAuthenticationProvider implements AuthenticationProviderInterface
2328
{
2429
private $userChecker;

Authentication/Provider/UserAuthenticationProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@
2222
use Symfony\Component\Security\Core\User\UserCheckerInterface;
2323
use Symfony\Component\Security\Core\User\UserInterface;
2424

25+
trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', UserAuthenticationProvider::class);
26+
2527
/**
2628
* UserProviderInterface retrieves users for UsernamePasswordToken tokens.
2729
*
2830
* @author Fabien Potencier <fabien@symfony.com>
31+
*
32+
* @deprecated since Symfony 5.3, use the new authenticator system instead
2933
*/
3034
abstract class UserAuthenticationProvider implements AuthenticationProviderInterface
3135
{

Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getUsername(/* $legacy = true */)
6868

6969
public function getUserIdentifier(): string
7070
{
71-
// method returns "null" in non-legacy mode if not overriden
71+
// method returns "null" in non-legacy mode if not overridden
7272
$username = $this->getUsername(false);
7373
if (null !== $username) {
7474
trigger_deprecation('symfony/security-core', '5.3', 'Method "%s::getUsername()" is deprecated, override "getUserIdentifier()" instead.', get_debug_type($this));

0 commit comments

Comments
 (0)