Skip to content

Commit 5ad6f69

Browse files
Merge branch '5.2' into 5.x
* 5.2: [SecurityBundle] add missing type-hint [SecurityBundle] Remove invalid unused service [Security] [DataCollector] Remove allows anonymous information in datacollector [Workflow] Remove dead call to `Defnition#addTag()` add chinese translation
2 parents 69a0b29 + d1d83c2 commit 5ad6f69

File tree

9 files changed

+35
-15
lines changed

9 files changed

+35
-15
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

-4
Original file line numberDiff line numberDiff line change
@@ -832,10 +832,6 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
832832
$definitionDefinition->addArgument($transitions);
833833
$definitionDefinition->addArgument($initialMarking);
834834
$definitionDefinition->addArgument(new Reference(sprintf('%s.metadata_store', $workflowId)));
835-
$definitionDefinition->addTag('workflow.definition', [
836-
'name' => $name,
837-
'type' => $type,
838-
]);
839835

840836
// Create MarkingStore
841837
if (isset($workflow['marking_store']['type'])) {

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
4444
private $firewallMap;
4545
private $firewall;
4646
private $hasVarDumper;
47+
private $authenticatorManagerEnabled;
4748

48-
public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null)
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)
4950
{
5051
$this->tokenStorage = $tokenStorage;
5152
$this->roleHierarchy = $roleHierarchy;
@@ -54,6 +55,7 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
5455
$this->firewallMap = $firewallMap;
5556
$this->firewall = $firewall;
5657
$this->hasVarDumper = class_exists(ClassStub::class);
58+
$this->authenticatorManagerEnabled = $authenticatorManagerEnabled;
5759
}
5860

5961
/**
@@ -207,6 +209,8 @@ public function collect(Request $request, Response $response, \Throwable $except
207209
if ($this->firewall) {
208210
$this->data['listeners'] = $this->firewall->getWrappedListeners();
209211
}
212+
213+
$this->data['authenticator_manager_enabled'] = $this->authenticatorManagerEnabled;
210214
}
211215

212216
/**
@@ -392,4 +396,9 @@ public function getName()
392396
{
393397
return 'security';
394398
}
399+
400+
public function isAuthenticatorManagerEnabled(): bool
401+
{
402+
return $this->data['authenticator_manager_enabled'];
403+
}
395404
}

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ public function load(array $configs, ContainerBuilder $container)
142142
$loader->load('collectors.php');
143143
$loader->load('guard.php');
144144

145+
$container->getDefinition('data_collector.security')->addArgument($this->authenticatorManagerEnabled);
146+
145147
if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {
146148
$loader->load('security_debug.php');
147149
}

src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_login_link.php

-8
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,5 @@
6666
service('request_stack'),
6767
])
6868
->alias(LoginLinkHandlerInterface::class, 'security.authenticator.firewall_aware_login_link_handler')
69-
70-
->set('security.authenticator.entity_login_link_user_handler', EntityLoginLinkUserHandler::class)
71-
->abstract()
72-
->args([
73-
service('doctrine'),
74-
abstract_arg('user entity class name'),
75-
])
76-
->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.')
7769
;
7870
};

src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig

+2
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@
159159
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.firewall.stateless ? 'yes' : 'no') ~ '.svg') }}</span>
160160
<span class="label">Stateless</span>
161161
</div>
162+
{% if collector.authenticatorManagerEnabled == false %}
162163
<div class="metric">
163164
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.firewall.allows_anonymous ? 'yes' : 'no') ~ '.svg') }}</span>
164165
<span class="label">Allows anonymous</span>
165166
</div>
167+
{% endif %}
166168
</div>
167169

168170
{% if collector.firewall.security_enabled %}

src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function testCollectWhenAuthenticationTokenIsNull()
7171
$this->assertCount(0, $collector->getInheritedRoles());
7272
$this->assertEmpty($collector->getUser());
7373
$this->assertNull($collector->getFirewall());
74+
$this->assertFalse($collector->isAuthenticatorManagerEnabled());
7475
}
7576

7677
/** @dataProvider provideRoles */
@@ -93,6 +94,7 @@ public function testCollectAuthenticationTokenAndRoles(array $roles, array $norm
9394
$this->assertSame($normalizedRoles, $collector->getRoles()->getValue(true));
9495
$this->assertSame($inheritedRoles, $collector->getInheritedRoles()->getValue(true));
9596
$this->assertSame('hhamon', $collector->getUser());
97+
$this->assertFalse($collector->isAuthenticatorManagerEnabled());
9698
}
9799

98100
public function testCollectSwitchUserToken()
@@ -132,7 +134,7 @@ public function testGetFirewall()
132134
->with($request)
133135
->willReturn($firewallConfig);
134136

135-
$collector = new SecurityDataCollector(null, null, null, null, $firewallMap, new TraceableFirewallListener($firewallMap, new EventDispatcher(), new LogoutUrlGenerator()));
137+
$collector = new SecurityDataCollector(null, null, null, null, $firewallMap, new TraceableFirewallListener($firewallMap, new EventDispatcher(), new LogoutUrlGenerator()), true);
136138
$collector->collect($request, new Response());
137139
$collector->lateCollect();
138140
$collected = $collector->getFirewall();
@@ -149,6 +151,7 @@ public function testGetFirewall()
149151
$this->assertSame($firewallConfig->getAccessDeniedUrl(), $collected['access_denied_url']);
150152
$this->assertSame($firewallConfig->getUserChecker(), $collected['user_checker']);
151153
$this->assertSame($firewallConfig->getListeners(), $collected['listeners']->getValue());
154+
$this->assertTrue($collector->isAuthenticatorManagerEnabled());
152155
}
153156

154157
public function testGetFirewallReturnsNull()

src/Symfony/Component/Security/Core/Resources/translations/security.zh_CN.xlf

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@
7070
<source>Invalid or expired login link.</source>
7171
<target>失效或过期的登入链接。</target>
7272
</trans-unit>
73+
<trans-unit id="19">
74+
<source>Too many failed login attempts, please try again in %minutes% minute.</source>
75+
<target>登入失败的次数过多,请在%minutes%分钟后再试。</target>
76+
</trans-unit>
77+
<trans-unit id="20">
78+
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
79+
<target>登入失败的次数过多,请在%minutes%分钟后再试。</target>
80+
</trans-unit>
7381
</body>
7482
</file>
7583
</xliff>

src/Symfony/Component/Security/Core/Resources/translations/security.zh_TW.xlf

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@
7070
<source>Invalid or expired login link.</source>
7171
<target>失效或過期的登入鏈接。</target>
7272
</trans-unit>
73+
<trans-unit id="19">
74+
<source>Too many failed login attempts, please try again in %minutes% minute.</source>
75+
<target>登錄失敗的次數過多,請在%minutes%分鐘後再試。</target>
76+
</trans-unit>
77+
<trans-unit id="20">
78+
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
79+
<target>登錄失敗的次數過多,請在%minutes%分鐘後再試。</target>
80+
</trans-unit>
7381
</body>
7482
</file>
7583
</xliff>

src/Symfony/Component/Security/Http/Authenticator/InteractiveAuthenticatorInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* Interactive login requires explicit user action (e.g. a login
1919
* form or HTTP basic authentication). Implementing this interface
20-
* will dispatcher the InteractiveLoginEvent upon successful login.
20+
* will dispatch the InteractiveLoginEvent upon successful login.
2121
*
2222
* @author Wouter de Jong <[email protected]>
2323
*/

0 commit comments

Comments
 (0)