8000 minor #20407 [SecurityBundle] FirewallConfig's user_checker should be… · symfony/symfony@fc557db · GitHub
[go: up one dir, main page]

Skip to content

Commit fc557db

Browse files
committed
minor #20407 [SecurityBundle] FirewallConfig's user_checker should be mandatory (chalasr)
This PR was merged into the 3.2-dev branch. Discussion ---------- [SecurityBundle] FirewallConfig's user_checker should be mandatory | Q | A | ------------- | --- | Branch? | master | Tests pass? | yes | Fixed tickets | #20404 (comment) | License | MIT Commits ------- 6754af2 [SecurityBundle] FirewallConfig's user_checker should be mandatory
2 parents 48ff2bd + 6754af2 commit fc557db

File tree

7 files changed

+20
-19
lines changed

7 files changed

+20
-19
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,15 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
280280
}
281281

282282
$config->replaceArgument(1, (string) $matcher);
283-
$config->replaceArgument(2, $firewall['security']);
283+
$config->replaceArgument(2, $firewall['user_checker']);
284+
$config->replaceArgument(3, $firewall['security']);
284285

285286
// Security disabled?
286287
if (false === $firewall['security']) {
287288
return array($matcher, array(), null);
288289
}
289290

290-
$config->replaceArgument(3, $firewall['stateless']);
291+
$config->replaceArgument(4, $firewall['stateless']);
291292

292293
// Provider id (take the first registered provider if none defined)
293294
if (isset($firewall['provider'])) {
@@ -296,7 +297,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
296297
$defaultProvider = reset($providerIds);
297298
}
298299

299-
$config->replaceArgument(4, $defaultProvider);
300+
$config->replaceArgument(5, $defaultProvider);
300301

301302
// Register listeners
302303
$listeners = array();
@@ -312,7 +313,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
312313
$contextKey = $firewall['context'];
313314
}
314315

315-
$config->replaceArgument(5, $contextKey);
316+
$config->replaceArgument(6, $contextKey);
316317

317318
$listeners[] = new Reference($this->createContextListener($container, $contextKey));
318319
}
@@ -382,7 +383,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
382383
// Authentication listeners
383384
list($authListeners, $defaultEntryPoint) = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $configuredEntryPoint);
384385

385-
$config->replaceArgument(6, $configuredEntryPoint ?: $defaultEntryPoint);
386+
$config->replaceArgument(7, $configuredEntryPoint ?: $defaultEntryPoint);
386387

387388
$listeners = array_merge($listeners, $authListeners);
388389

@@ -399,14 +400,13 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
399400
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint, $firewall['stateless']));
400401

401402
if (isset($firewall['access_denied_handler'])) {
402-
$config->replaceArgument(7, $firewall['access_denied_handler']);
403+
$config->replaceArgument(8, $firewall['access_denied_handler']);
403404
}
404405
if (isset($firewall['access_denied_url'])) {
405-
$config->replaceArgument(8, $firewall['access_denied_url']);
406+
$config->replaceArgument(9, $firewall['access_denied_url']);
406407
}
407408

408409
$container->setAlias(new Alias('security.user_checker.'.$id, false), $firewall['user_checker']);
409-
$config->replaceArgument(9, $firewall['user_checker']);
410410

411411
foreach ($this->factories as $position) {
412412
foreach ($position as $factory) {

src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@
117117
<service id="security.firewall.config" class="Symfony\Bundle\SecurityBundle\Security\FirewallConfig" abstract="true" public="false">
118118
<argument /> <!-- name -->
119119
<argument /> <!-- request_matcher -->
120+
<argument /> <!-- user_checker -->
120121
<argument /> <!-- security enabled -->
121122
<argument /> <!-- stateless -->
122123
<argument /> <!-- provider -->
123124
<argument /> <!-- context -->
124125
<argument /> <!-- entry_point -->
125126
<argument /> <!-- access_denied_handler -->
126127
<argument /> <!-- access_denied_url -->
127-
<argument /> <!-- user_checker -->
128128
<argument type="collection" /> <!-- listeners -->
129129
</service>
130130

src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,41 @@ final class FirewallConfig
1818
{
1919
private $name;
2020
private $requestMatcher;
21+
private $userChecker;
2122
private $securityEnabled;
2223
private $stateless;
2324
private $provider;
2425
private $context;
2526
private $entryPoint;
2627
private $accessDeniedHandler;
2728
private $accessDeniedUrl;
28-
private $userChecker;
2929
private $listeners;
3030

3131
/**
3232
* @param string $name
3333
* @param string $requestMatcher
34+
* @param string $userChecker
3435
* @param bool $securityEnabled
3536
* @param bool $stateless
3637
* @param string|null $provider
3738
* @param string|null $context
3839
* @param string|null $entryPoint
3940
* @param string|null $accessDeniedHandler
4041
* @param string|null $accessDeniedUrl
41-
* @param string|null $userChecker
4242
* @param string[] $listeners
4343
*/
44-
public function __construct($name, $requestMatcher, $securityEnabled = true, $stateless = false, $provider = null, $context = null, $entryPoint = null, $accessDeniedHandler = null, $accessDeniedUrl = null, $userChecker = null, $listeners = array())
44+
public function __construct($name, $requestMatcher, $userChecker, $securityEnabled = true, $stateless = false, $provider = null, $context = null, $entryPoint = null, $accessDeniedHandler = null, $accessDeniedUrl = null, $listeners = array())
4545
{
4646
$this->name = $name;
4747
$this->requestMatcher = $requestMatcher;
48+
$this->userChecker = $userChecker;
4849
$this->securityEnabled = $securityEnabled;
4950
$this->stateless = $stateless;
5051
$this->provider = $provider;
5152
$this->context = $context;
5253
$this->entryPoint = $entryPoint;
5354
$this->accessDeniedHandler = $accessDeniedHandler;
5455
$this->accessDeniedUrl = $accessDeniedUrl;
55-
$this->userChecker = $userChecker;
5656
$this->listeners = $listeners;
5757
}
5858

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testCollectAuthenticationTokenAndRoles(array $roles, array $norm
7878

7979
public function testGetFirewall()
8080
{
81-
$firewallConfig = new FirewallConfig('dummy', 'security.request_matcher.dummy');
81+
$firewallConfig = new FirewallConfig('dummy', 'security.request_matcher.dummy', 'security.user_checker.dummy');
8282
$request = $this->getRequest();
8383

8484
$firewallMap = $this

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,17 @@ public function testFirewalls()
7979
array(
8080
'simple',
8181
'security.request_matcher.707b20193d4cb9f2718114abcbebb32af48f948484fc166a03482f49bf14f25e271f72c7',
82+
'security.user_checker',
8283
false,
8384
),
8485
array(
8586
'secure',
8687
'',
88+
'security.user_checker',
8789
true,
8890
true,
8991
'security.user.provider.concrete.default',
9092
'security.authentication.form_entry_point.secure',
91-
'security.user_checker',
9293
array(
9394
'logout',
9495
'switch_user',
@@ -104,12 +105,12 @@ public function testFirewalls()
104105
array(
105106
'host',
106107
'security.request_matcher.dda8b565689ad8509623ee68fb2c639cd81cd4cb339d60edbaf7d67d30e6aa09bd8c63c3',
108+
'security.user_checker',
107109
true,
108110
false,
109111
'security.user.provider.concrete.default',
110112
'host',
111113
'security.authentication.basic_entry_point.host',
112-
'security.user_checker',
113114
array(
114115
'http_basic',
115116
'anonymous',
@@ -118,12 +119,12 @@ public function testFirewalls()
118119
array(
119120
'with_user_checker',
120121
'',
122+
'app.user_checker',
121123
true,
122124
false,
123125
'security.user.provider.concrete.default',
124126
'with_user_checker',
125127
'security.authentication.basic_entry_point.with_user_checker',
126-
'app.user_checker',
127128
array(
128129
'http_basic',
129130
'anonymous',

src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ public function testGetters()
3333
$config = new FirewallConfig(
3434
'foo_firewall',
3535
$options['request_matcher'],
36+
$options['user_checker'],
3637
$options['security'],
3738
$options['stateless'],
3839
$options['provider'],
3940
$options['context'],
4041
$options['entry_point'],
4142
$options['access_denied_handler'],
4243
$options['access_denied_url'],
43-
$options['user_checker'],
4444
$listeners
4545
);
4646

src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FirewallContextTest extends \PHPUnit_Framework_TestCase
2020
{
2121
public function testGetters()
2222
{
23-
$config = new FirewallConfig('main', 'request_matcher');
23+
$config = new FirewallConfig('main', 'request_matcher', 'user_checker');
2424

2525
$exceptionListener = $this
2626
->getMockBuilder(ExceptionListener::class)

0 commit comments

Comments
 (0)
0