Skip to content

Navigation Menu

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 db6d1bc

Browse filesBrowse files
committed
[Security] Remove everything related to the deprecated authentication manager
1 parent bf7201e commit db6d1bc
Copy full SHA for db6d1bc

File tree

155 files changed

+232
-11859
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

155 files changed

+232
-11859
lines changed

‎src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,17 @@ final class DebugFirewallCommand extends Command
3535
private $contexts;
3636
private $eventDispatchers;
3737
private $authenticators;
38-
private $authenticatorManagerEnabled;
3938

4039
/**
4140
* @param string[] $firewallNames
4241
* @param AuthenticatorInterface[][] $authenticators
4342
*/
44-
public function __construct(array $firewallNames, ContainerInterface $contexts, ContainerInterface $eventDispatchers, array $authenticators, bool $authenticatorManagerEnabled)
43+
public function __construct(array $firewallNames, ContainerInterface $contexts, ContainerInterface $eventDispatchers, array $authenticators)
4544
{
4645
$this->firewallNames = $firewallNames;
4746
$this->contexts = $contexts;
4847
$this->eventDispatchers = $eventDispatchers;
4948
$this->authenticators = $authenticators;
50-
$this->authenticatorManagerEnabled = $authenticatorManagerEnabled;
5149

5250
parent::__construct();
5351
}
@@ -115,9 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
115113
$this->displayEventListeners($name, $context, $io);
116114
}
117115

118-
if ($this->authenticatorManagerEnabled) {
119-
$this->displayAuthenticators($name, $io);
120-
}
116+
$this->displayAuthenticators($name, $io);
121117

122118
return 0;
123119
}

‎src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
4444
private $firewallMap;
4545
private $firewall;
4646
private $hasVarDumper;
47-
private $authenticatorManagerEnabled;
4847

49-
public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false)
48+
public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null)
5049
{
5150
$this->tokenStorage = $tokenStorage;
5251
$this->roleHierarchy = $roleHierarchy;
@@ -55,7 +54,6 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
5554
$this->firewallMap = $firewallMap;
5655
$this->firewall = $firewall;
5756
$this->hasVarDumper = class_exists(ClassStub::class);
58-
$this->authenticatorManagerEnabled = $authenticatorManagerEnabled;
5957
}
6058

6159
/**
@@ -209,8 +207,6 @@ public function collect(Request $request, Response $response, \Throwable $except
209207
if ($this->firewall) {
210208
$this->data['listeners'] = $this->firewall->getWrappedListeners();
211209
}
212-
213-
$this->data['authenticator_manager_enabled'] = $this->authenticatorManagerEnabled;
214210
}
215211

216212
/**
@@ -399,6 +395,6 @@ public function getName()
399395

400396
public function isAuthenticatorManagerEnabled(): bool
401397
{
402-
return $this->data['authenticator_manager_enabled'];
398+
return true;
403399
}
404400
}

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php
+3-87Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
2525
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2626
*/
27-
abstract class AbstractFactory implements SecurityFactoryInterface
27+
abstract class AbstractFactory implements AuthenticatorFactoryInterface
2828
{
2929
protected $options = [
3030
'check_path' => '/login_check',
@@ -48,26 +48,9 @@ abstract class AbstractFactory implements SecurityFactoryInterface
4848
'failure_path_parameter' => '_failure_path',
4949
];
5050

51-
public function create(ContainerBuilder $container, string $id, array $config, string $userProviderId, ?string $defaultEntryPointId)
51+
final public function addOption(string $name, $default = null)
5252
{
53-
// authentication provider
54-
$authProviderId = $this->createAuthProvider($container, $id, $config, $userProviderId);
55-
56-
// authentication listener
57-
$listenerId = $this->createListener($container, $id, $config, $userProviderId);
58-
59-
// add remember-me aware tag if requested
60-
if ($this->isRememberMeAware($config)) {
61-
$container
62-
->getDefinition($listenerId)
63-
->addTag('security.remember_me_aware', ['id' => $id, 'provider' => $userProviderId])
64-
;
65-
}
66-
67-
// create entry point if applicable (optional)
68-
$entryPointId = $this->createEntryPoint($container, $id, $config, $defaultEntryPointId);
69-
70-
return [$authProviderId, $listenerId, $entryPointId];
53+
$this->options[$name] = $default;
7154
}
7255

7356
public function addConfiguration(NodeDefinition $node)
@@ -90,73 +73,6 @@ public function addConfiguration(NodeDefinition $node)
9073
}
9174
}
9275

93-
final public function addOption(string $name, $default = null)
94-
{
95-
$this->options[$name] = $default;
96-
}
97-
98-
/**
99-
* Subclasses must return the id of a service which implements the
100-
* AuthenticationProviderInterface.
101-
*
102-
* @return string never null, the id of the authentication provider
103-
*/
104-
abstract protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId);
105-
106-
/**
107-
* Subclasses must return the id of the abstract listener template.
108-
*
109-
* Listener definitions should inherit from the AbstractAuthenticationListener
110-
* like this:
111-
*
112-
* <service id="my.listener.id"
113-
* class="My\Concrete\Classname"
114-
* parent="security.authentication.listener.abstract"
115-
* abstract="true" />
116-
*
117-
* In the above case, this method would return "my.listener.id".
118-
*
119-
* @return string
120-
*/
121-
abstract protected function getListenerId();
122-
123-
/**
124-
* Subclasses may create an entry point of their as they see fit. The
125-
* default implementation does not change the default entry point.
126-
*
127-
* @return string|null the entry point id
128-
*/
129-
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
130-
{
131-
return $defaultEntryPointId;
132-
}
133-
134-
/**
135-
* Subclasses may disable remember-me features for the listener, by
136-
* always returning false from this method.
137-
*
138-
* @return bool Whether a possibly configured RememberMeServices should be set for this listener
139-
*/
140-
protected function isRememberMeAware(array $config)
141-
{
142-
return $config['remember_me'];
143-
}
144-
145-
protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider)
146-
{
147-
$listenerId = $this->getListenerId();
148-
$listener = new ChildDefinition($listenerId);
149-
$listener->replaceArgument(4, $id);
150-
$listener->replaceArgument(5, new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)));
151-
$listener->replaceArgument(6, new Reference($this->createAuthenticationFailureHandler($container, $id, $config)));
152-
$listener->replaceArgument(7, array_intersect_key($config, $this->options));
153-
154-
$listenerId .= '.'.$id;
155-
$container->setDefinition($listenerId, $listener);
156-
157-
return $listenerId;
158-
}
159-
16076
protected function createAuthenticationSuccessHandler(ContainerBuilder $container, string $id, array $config)
16177
{
16278
$successHandlerId = $this->getSuccessHandlerId($id);

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AnonymousFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AnonymousFactory.php
-78Lines changed: 0 additions & 78 deletions
This file was deleted.

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,32 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
1313

14+
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
1415
use Symfony\Component\DependencyInjection\ContainerBuilder;
1516

1617
/**
1718
* @author Wouter de Jong <wouter@wouterj.nl>
1819
*/
1920
interface AuthenticatorFactoryInterface
2021
{
22+
/**
23+
* Defines the position at which the provider is called.
24+
* Possible values: pre_auth, form, http, and remember_me.
25+
*
26+
* @return string
27+
*/
28+
public function getPosition();
29+
30+
/**
31+
* Defines the configuration key used to reference the provider
32+
* in the firewall configuration.
33+
*
34+
* @return string
35+
*/
36+
public function getKey();
37+
38+
public function addConfiguration(NodeDefinition $builder);
39+
2140
/**
2241
* Creates the authenticator service(s) for the provided configuration.
2342
*

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@
2020
*
2121
* @internal
2222
*/
23-
class CustomAuthenticatorFactory implements AuthenticatorFactoryInterface, SecurityFactoryInterface
23+
class CustomAuthenticatorFactory implements AuthenticatorFactoryInterface
2424
{
25-
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
26-
{
27-
throw new \LogicException('Custom authenticators are not supported when "security.enable_authenticator_manager" is not set to true.');
28-
}
29-
3025
public function getPosition(): string
3126
{
3227
return 'pre_auth';

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginFactory.php
+1-48Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @internal
2727
*/
28-
class FormLoginFactory extends AbstractFactory implements AuthenticatorFactoryInterface
28+
class FormLoginFactory extends AbstractFactory
2929
{
3030
public function __construct()
3131
{
@@ -58,53 +58,6 @@ public function addConfiguration(NodeDefinition $node)
5858
;
5959
}
6060

61-
protected function getListenerId()
62-
{
63-
return 'security.authentication.listener.form';
64-
}
65-
66-
protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId)
67-
{
68-
if ($config['enable_csrf'] ?? false) {
69-
throw new InvalidConfigurationException('The "enable_csrf" option of "form_login" is only available when "security.enable_authenticator_manager" is set to "true", use "csrf_token_generator" instead.');
70-
}
71-
72-
$provider = 'security.authentication.provider.dao.'.$id;
73-
$container
74-
->setDefinition($provider, new ChildDefinition('security.authentication.provider.dao'))
75-
->replaceArgument(0, new Reference($userProviderId))
76-
->replaceArgument(1, new Reference('security.user_checker.'.$id))
77-
->replaceArgument(2, $id)
78-
;
79-
80-
return $provider;
81-
}
82-
83-
protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider)
84-
{
85-
$listenerId = parent::createListener($container, $id, $config, $userProvider);
86-
87-
$container
88-
->getDefinition($listenerId)
89-
->addArgument(isset($config['csrf_token_generator']) ? new Reference($config['csrf_token_generator']) : null)
90-
;
91-
92-
return $listenerId;
93-
}
94-
95-
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
96-
{
97-
$entryPointId = 'security.authentication.form_entry_point.'.$id;
98-
$container
99-
->setDefinition($entryPointId, new ChildDefinition('security.authentication.form_entry_point'))
100-
->addArgument(new Reference('security.http_utils'))
101-
->addArgument($config['login_path'])
102-
->addArgument($config['use_forward'])
103-
;
104-
105-
return $entryPointId;
106-
}
107-
10861
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
10962
{
11063
if (isset($config['csrf_token_generator'])) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.