@@ -101,10 +101,10 @@ authentication (i.e. the old-school username/password box):
101101 $container->loadFromExtension('security', array(
102102 'firewalls' => array(
103103 'secured_area' => array(
104- 'pattern' => '^/',
105- 'anonymous' => array(),
104+ 'pattern' => '^/',
105+ 'anonymous' => array(),
106106 'http_basic' => array(
107- 'realm' => 'Secured Demo Area',
107+ 'realm' => 'Secured Demo Area',
108108 ),
109109 ),
110110 ),
@@ -153,6 +153,8 @@ Symfony's security system works by determining who a user is (i.e. authenticatio
153153and then checking to see if that user should have access to a specific resource
154154or URL.
155155
156+ .. _book-security-firewalls :
157+
156158Firewalls (Authentication)
157159~~~~~~~~~~~~~~~~~~~~~~~~~~
158160
@@ -324,8 +326,8 @@ First, enable form login under your firewall:
324326 $container->loadFromExtension('security', array(
325327 'firewalls' => array(
326328 'secured_area' => array(
327- 'pattern' => '^/',
328- 'anonymous' => array(),
329+ 'pattern' => '^/',
330+ 'anonymous' => array(),
329331 'form_login' => array(
330332 'login_path' => 'login',
331333 'check_path' => 'login_check',
@@ -643,11 +645,11 @@ see :doc:`/cookbook/security/form_login`.
643645
644646 'firewalls' => array(
645647 'login_firewall' => array(
646- 'pattern' => '^/login$',
648+ 'pattern' => '^/login$',
647649 'anonymous' => array(),
648650 ),
649651 'secured_area' => array(
650- 'pattern' => '^/',
652+ 'pattern' => '^/',
651653 'form_login' => array(),
652654 ),
653655 ),
@@ -664,8 +666,10 @@ see :doc:`/cookbook/security/form_login`.
664666
665667 If you're using multiple firewalls and you authenticate against one firewall,
666668 you will *not * be authenticated against any other firewalls automatically.
667- Different firewalls are like different security systems. That's why,
668- for most applications, having one main firewall is enough.
669+ Different firewalls are like different security systems. To do this you have
670+ to explicitly specify the same:ref: `reference-security-firewall-context `
671+ for different firewalls. But usually for most applications, having one
672+ main firewall is enough.
669673
670674Authorization
671675-------------
@@ -728,7 +732,7 @@ You can define as many URL patterns as you need - each is a regular expression.
728732
729733 // app/config/security.php
730734 $container->loadFromExtension('security', array(
731- // ...
735+ ...,
732736 'access_control' => array(
733737 array('path' => '^/admin/users', 'role' => 'ROLE_SUPER_ADMIN'),
734738 array('path' => '^/admin', 'role' => 'ROLE_ADMIN'),
@@ -1080,7 +1084,7 @@ In fact, you've seen this already in the example in this chapter.
10801084
10811085 // app/config/security.php
10821086 $container->loadFromExtension('security', array(
1083- // ...
1087+ ...,
10841088 'providers' => array(
10851089 'default_provider' => array(
10861090 'memory' => array(
@@ -1323,8 +1327,7 @@ configure the encoder for that user:
13231327
13241328 // app/config/security.php
13251329 $container->loadFromExtension('security', array(
1326- // ...
1327-
1330+ ...,
13281331 'encoders' => array(
13291332 'Acme\UserBundle\Entity\User' => 'sha512',
13301333 ),
@@ -1551,10 +1554,10 @@ the first provider is always used:
15511554 $container->loadFromExtension('security', array(
15521555 'firewalls' => array(
15531556 'secured_area' => array(
1554- // ...
1557+ ...,
15551558 'provider' => 'user_db',
15561559 'http_basic' => array(
1557- // ...
1560+ ...,
15581561 'provider' => 'in_memory',
15591562 ),
15601563 'form_login' => array(),
@@ -1825,7 +1828,7 @@ done by activating the ``switch_user`` firewall listener:
18251828 $container->loadFromExtension('security', array(
18261829 'firewalls' => array(
18271830 'main'=> array(
1828- // ...
1831+ ...,
18291832 'switch_user' => true
18301833 ),
18311834 ),
@@ -1859,7 +1862,11 @@ to show a link to exit impersonation:
18591862 ..code-block ::html+php
18601863
18611864 <?php if ($view['security']->isGranted('ROLE_PREVIOUS_ADMIN')): ?>
1862- <a href="<?php echo $view['router']->generate('homepage', array('_switch_user' => '_exit') ?>">Exit impersonation</a>
1865+ <a
1866+ href="<?php echo $view['router']->generate('homepage', array('_switch_user' => '_exit') ?>"
1867+ >
1868+ Exit impersonation
1869+ </a>
18631870 <?php endif; ?>
18641871
18651872Of course, this feature needs to be made available to a small group of users.