From 26d156f17f361cf5347f9553f7c029eb3602f5b3 Mon Sep 17 00:00:00 2001 From: fd6130 Date: Sun, 16 May 2021 22:49:50 +0800 Subject: [PATCH 1/5] add chinese translation --- .../Core/Resources/translations/security.zh_CN.xlf | 8 ++++++++ .../Core/Resources/translations/security.zh_TW.xlf | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.zh_CN.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.zh_CN.xlf index ce9d6fd224..6c4934ed86 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.zh_CN.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.zh_CN.xlf @@ -70,6 +70,14 @@ Invalid or expired login link. 失效或过期的登入链接。 + + Too many failed login attempts, please try again in %minutes% minute. + 登入失败的次数过多,请在%minutes%分钟后再试。 + + + Too many failed login attempts, please try again in %minutes% minutes. + 登入失败的次数过多,请在%minutes%分钟后再试。 + diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.zh_TW.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.zh_TW.xlf index 8631047318..fd30587938 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.zh_TW.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.zh_TW.xlf @@ -70,6 +70,14 @@ Invalid or expired login link. 失效或過期的登入鏈接。 + + Too many failed login attempts, please try again in %minutes% minute. + 登錄失敗的次數過多,請在%minutes%分鐘後再試。 + + + Too many failed login attempts, please try again in %minutes% minutes. + 登錄失敗的次數過多,請在%minutes%分鐘後再試。 + From 324dc750de316fefd5116ab3082d1c993d766796 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 17 May 2021 23:23:42 +0200 Subject: [PATCH 2/5] [Workflow] Remove dead call to `Defnition#addTag()` --- .../DependencyInjection/FrameworkExtension.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index f2f6972d31..bce07d52fc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -795,10 +795,6 @@ class FrameworkExtension extends Extension $definitionDefinition->addArgument($transitions); $definitionDefinition->addArgument($initialMarking); $definitionDefinition->addArgument(new Reference(sprintf('%s.metadata_store', $workflowId))); - $definitionDefinition->addTag('workflow.definition', [ - 'name' => $name, - 'type' => $type, - ]); // Create MarkingStore if (isset($workflow['marking_store']['type'])) { From 92cd0967630e163616e065eb05a1ba299a69431a Mon Sep 17 00:00:00 2001 From: Smaine Milianni Date: Sun, 9 May 2021 14:47:38 +0100 Subject: [PATCH 3/5] [Security] [DataCollector] Remove allows anonymous information in datacollector --- .../DataCollector/SecurityDataCollector.php | 11 ++++++++++- .../DependencyInjection/SecurityExtension.php | 2 ++ .../Resources/views/Collector/security.html.twig | 2 ++ .../Tests/DataCollector/SecurityDataCollectorTest.php | 5 ++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php index 16bad6df54..f16adbe8c1 100644 --- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php +++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php @@ -44,8 +44,9 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn private $firewallMap; private $firewall; private $hasVarDumper; + private $authenticatorManagerEnabled; - public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null) + public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, $authenticatorManagerEnabled = false) { $this->tokenStorage = $tokenStorage; $this->roleHierarchy = $roleHierarchy; @@ -54,6 +55,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn $this->firewallMap = $firewallMap; $this->firewall = $firewall; $this->hasVarDumper = class_exists(ClassStub::class); + $this->authenticatorManagerEnabled = $authenticatorManagerEnabled; } /** @@ -204,6 +206,8 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn if ($this->firewall) { $this->data['listeners'] = $this->firewall->getWrappedListeners(); } + + $this->data['authenticator_manager_enabled'] = $this->authenticatorManagerEnabled; } /** @@ -389,4 +393,9 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn { return 'security'; } + + public function isAuthenticatorManagerEnabled(): bool + { + return $this->data['authenticator_manager_enabled']; + } } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index b59ac7b66d..6f48e5313d 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -132,6 +132,8 @@ class SecurityExtension extends Extension implements PrependExtensionInterface $loader->load('collectors.php'); $loader->load('guard.php'); + $container->getDefinition('data_collector.security')->addArgument($this->authenticatorManagerEnabled); + if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) { $loader->load('security_debug.php'); } diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig index 6b0819513f..9f69abcaf2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig +++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig @@ -159,10 +159,12 @@ {{ include('@WebProfiler/Icon/' ~ (collector.firewall.stateless ? 'yes' : 'no') ~ '.svg') }} Stateless + {% if collector.authenticatorManagerEnabled == false %}
{{ include('@WebProfiler/Icon/' ~ (collector.firewall.allows_anonymous ? 'yes' : 'no') ~ '.svg') }} Allows anonymous
+ {% endif %} {% if collector.firewall.security_enabled %} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php index 1febc6ad5e..fbba6c8fba 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php @@ -71,6 +71,7 @@ class SecurityDataCollectorTest extends TestCase $this->assertCount(0, $collector->getInheritedRoles()); $this->assertEmpty($collector->getUser()); $this->assertNull($collector->getFirewall()); + $this->assertFalse($collector->isAuthenticatorManagerEnabled()); } /** @dataProvider provideRoles */ @@ -93,6 +94,7 @@ class SecurityDataCollectorTest extends TestCase $this->assertSame($normalizedRoles, $collector->getRoles()->getValue(true)); $this->assertSame($inheritedRoles, $collector->getInheritedRoles()->getValue(true)); $this->assertSame('hhamon', $collector->getUser()); + $this->assertFalse($collector->isAuthenticatorManagerEnabled()); } public function testCollectSwitchUserToken() @@ -132,7 +134,7 @@ class SecurityDataCollectorTest extends TestCase ->with($request) ->willReturn($firewallConfig); - $collector = new SecurityDataCollector(null, null, null, null, $firewallMap, new TraceableFirewallListener($firewallMap, new EventDispatcher(), new LogoutUrlGenerator())); + $collector = new SecurityDataCollector(null, null, null, null, $firewallMap, new TraceableFirewallListener($firewallMap, new EventDispatcher(), new LogoutUrlGenerator()), true); $collector->collect($request, new Response()); $collector->lateCollect(); $collected = $collector->getFirewall(); @@ -149,6 +151,7 @@ class SecurityDataCollectorTest extends TestCase $this->assertSame($firewallConfig->getAccessDeniedUrl(), $collected['access_denied_url']); $this->assertSame($firewallConfig->getUserChecker(), $collected['user_checker']); $this->assertSame($firewallConfig->getListeners(), $collected['listeners']->getValue()); + $this->assertTrue($collector->isAuthenticatorManagerEnabled()); } public function testGetFirewallReturnsNull() From 1e6588a848366c33da4fffa0d60af3d16ff82295 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 19 May 2021 01:02:18 +0200 Subject: [PATCH 4/5] [SecurityBundle] Remove invalid unused service --- .../config/security_authenticator_login_link.php | 8 -------- .../Authenticator/InteractiveAuthenticatorInterface.php | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_login_link.php b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_login_link.php index 2248b5e8ee..299a162f38 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_login_link.php +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_login_link.php @@ -59,13 +59,5 @@ return static function (ContainerConfigurator $container) { service('request_stack'), ]) ->alias(LoginLinkHandlerInterface::class, 'security.authenticator.firewall_aware_login_link_handler') - - ->set('security.authenticator.entity_login_link_user_handler', EntityLoginLinkUserHandler::class) - ->abstract() - ->args([ - service('doctrine'), - abstract_arg('user entity class name'), - ]) - ; }; diff --git a/src/Symfony/Component/Security/Http/Authenticator/InteractiveAuthenticatorInterface.php b/src/Symfony/Component/Security/Http/Authenticator/InteractiveAuthenticatorInterface.php index 7f26d82606..71b6ade28d 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/InteractiveAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Http/Authenticator/InteractiveAuthenticatorInterface.php @@ -17,7 +17,7 @@ namespace Symfony\Component\Security\Http\Authenticator; * * Interactive login requires explicit user action (e.g. a login * form or HTTP basic authentication). Implementing this interface - * will dispatcher the InteractiveLoginEvent upon successful login. + * will dispatch the InteractiveLoginEvent upon successful login. * * @author Wouter de Jong */ From d1d83c29b971c45bb13c81b9f220eb0a8c53f1ca Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 19 May 2021 12:09:09 +0200 Subject: [PATCH 5/5] [SecurityBundle] add missing type-hint --- .../SecurityBundle/DataCollector/SecurityDataCollector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php index f16adbe8c1..c309e135e0 100644 --- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php +++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php @@ -46,7 +46,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn private $hasVarDumper; private $authenticatorManagerEnabled; - public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, $authenticatorManagerEnabled = false) + public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false) { $this->tokenStorage = $tokenStorage; $this->roleHierarchy = $roleHierarchy;