Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitc5d60fb

Browse files
committed
[Security] Remove everything related to the deprecated authentication manager
1 parentbf7201e commitc5d60fb

File tree

170 files changed

+241
-12212
lines changed

Some content is hidden

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

170 files changed

+241
-12212
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ protected function getUser()
401401
}
402402

403403
if (!\is_object($user =$token->getUser())) {
404-
// e.g. anonymous authentication
405404
returnnull;
406405
}
407406

‎src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
useSymfony\Component\HttpKernel\Exception\NotFoundHttpException;
4040
useSymfony\Component\HttpKernel\HttpKernelInterface;
4141
useSymfony\Component\Routing\RouterInterface;
42-
useSymfony\Component\Security\Core\Authentication\Token\AnonymousToken;
4342
useSymfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
4443
useSymfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
4544
useSymfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
@@ -146,16 +145,6 @@ public function testGetUser()
146145
$this->assertSame($controller->getUser(),$user);
147146
}
148147

149-
publicfunctiontestGetUserAnonymousUserConvertedToNull()
150-
{
151-
$token =newAnonymousToken('default','anon.');
152-
153-
$controller =$this->createController();
154-
$controller->setContainer($this->getContainerWithTokenStorage($token));
155-
156-
$this->assertNull($controller->getUser());
157-
}
158-
159148
publicfunctiontestGetUserWithEmptyTokenStorage()
160149
{
161150
$controller =$this->createController();

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

Lines 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-
publicfunction__construct(array$firewallNames,ContainerInterface$contexts,ContainerInterface$eventDispatchers,array$authenticators,bool$authenticatorManagerEnabled)
43+
publicfunction__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
return0;
123119
}

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
useSymfony\Component\HttpFoundation\Response;
1818
useSymfony\Component\HttpKernel\DataCollector\DataCollector;
1919
useSymfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
20-
useSymfony\Component\Security\Core\Authentication\Token\AnonymousToken;
2120
useSymfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
2221
useSymfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
2322
useSymfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
@@ -44,9 +43,8 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
4443
private$firewallMap;
4544
private$firewall;
4645
private$hasVarDumper;
47-
private$authenticatorManagerEnabled;
4846

49-
publicfunction__construct(TokenStorageInterface$tokenStorage =null,RoleHierarchyInterface$roleHierarchy =null,LogoutUrlGenerator$logoutUrlGenerator =null,AccessDecisionManagerInterface$accessDecisionManager =null,FirewallMapInterface$firewallMap =null,TraceableFirewallListener$firewall =null,bool$authenticatorManagerEnabled =false)
47+
publicfunction__construct(TokenStorageInterface$tokenStorage =null,RoleHierarchyInterface$roleHierarchy =null,LogoutUrlGenerator$logoutUrlGenerator =null,AccessDecisionManagerInterface$accessDecisionManager =null,FirewallMapInterface$firewallMap =null,TraceableFirewallListener$firewall =null)
5048
{
5149
$this->tokenStorage =$tokenStorage;
5250
$this->roleHierarchy =$roleHierarchy;
@@ -55,7 +53,6 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
5553
$this->firewallMap =$firewallMap;
5654
$this->firewall =$firewall;
5755
$this->hasVarDumper =class_exists(ClassStub::class);
58-
$this->authenticatorManagerEnabled =$authenticatorManagerEnabled;
5956
}
6057

6158
/**
@@ -114,7 +111,7 @@ public function collect(Request $request, Response $response, \Throwable $except
114111

115112
$logoutUrl =null;
116113
try {
117-
if (null !==$this->logoutUrlGenerator && !$tokeninstanceof AnonymousToken) {
114+
if (null !==$this->logoutUrlGenerator) {
118115
$logoutUrl =$this->logoutUrlGenerator->getLogoutPath();
119116
}
120117
}catch (\Exception$e) {
@@ -180,7 +177,6 @@ public function collect(Request $request, Response $response, \Throwable $except
180177
if (null !==$firewallConfig) {
181178
$this->data['firewall'] = [
182179
'name' =>$firewallConfig->getName(),
183-
'allows_anonymous' =>$firewallConfig->allowsAnonymous(),
184180
'request_matcher' =>$firewallConfig->getRequestMatcher(),
185181
'security_enabled' =>$firewallConfig->isSecurityEnabled(),
186182
'stateless' =>$firewallConfig->isStateless(),
@@ -209,8 +205,6 @@ public function collect(Request $request, Response $response, \Throwable $except
209205
if ($this->firewall) {
210206
$this->data['listeners'] =$this->firewall->getWrappedListeners();
211207
}
212-
213-
$this->data['authenticator_manager_enabled'] =$this->authenticatorManagerEnabled;
214208
}
215209

216210
/**
@@ -399,6 +393,6 @@ public function getName()
399393

400394
publicfunctionisAuthenticatorManagerEnabled():bool
401395
{
402-
return$this->data['authenticator_manager_enabled'];
396+
returntrue;
403397
}
404398
}

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

Lines 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-
abstractclass AbstractFactoryimplementsSecurityFactoryInterface
27+
abstractclass AbstractFactoryimplementsAuthenticatorFactoryInterface
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-
publicfunctioncreate(ContainerBuilder$container,string$id,array$config,string$userProviderId, ?string$defaultEntryPointId)
51+
finalpublicfunctionaddOption(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
publicfunctionaddConfiguration(NodeDefinition$node)
@@ -90,73 +73,6 @@ public function addConfiguration(NodeDefinition $node)
9073
}
9174
}
9275

93-
finalpublicfunctionaddOption(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-
abstractprotectedfunctioncreateAuthProvider(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-
abstractprotectedfunctiongetListenerId();
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-
protectedfunctioncreateEntryPoint(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-
protectedfunctionisRememberMeAware(array$config)
141-
{
142-
return$config['remember_me'];
143-
}
144-
145-
protectedfunctioncreateListener(ContainerBuilder$container,string$id,array$config,string$userProvider)
146-
{
147-
$listenerId =$this->getListenerId();
148-
$listener =newChildDefinition($listenerId);
149-
$listener->replaceArgument(4,$id);
150-
$listener->replaceArgument(5,newReference($this->createAuthenticationSuccessHandler($container,$id,$config)));
151-
$listener->replaceArgument(6,newReference($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
protectedfunctioncreateAuthenticationSuccessHandler(ContainerBuilder$container,string$id,array$config)
16177
{
16278
$successHandlerId =$this->getSuccessHandlerId($id);

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

Lines changed: 0 additions & 78 deletions
This file was deleted.

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,32 @@
1111

1212
namespaceSymfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
1313

14+
useSymfony\Component\Config\Definition\Builder\NodeDefinition;
1415
useSymfony\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+
publicfunctiongetPosition();
29+
30+
/**
31+
* Defines the configuration key used to reference the provider
32+
* in the firewall configuration.
33+
*
34+
* @return string
35+
*/
36+
publicfunctiongetKey();
37+
38+
publicfunctionaddConfiguration(NodeDefinition$builder);
39+
2140
/**
2241
* Creates the authenticator service(s) for the provided configuration.
2342
*

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@
2020
*
2121
* @internal
2222
*/
23-
class CustomAuthenticatorFactoryimplements AuthenticatorFactoryInterface, SecurityFactoryInterface
23+
class CustomAuthenticatorFactoryimplements AuthenticatorFactoryInterface
2424
{
25-
publicfunctioncreate(ContainerBuilder$container,string$id,array$config,string$userProvider, ?string$defaultEntryPoint)
26-
{
27-
thrownew \LogicException('Custom authenticators are not supported when "security.enable_authenticator_manager" is not set to true.');
28-
}
29-
3025
publicfunctiongetPosition():string
3126
{
3227
return'pre_auth';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp