@@ -67,7 +67,7 @@ configuration looks like this:
6767
6868 <firewall name =" dev"
6969 pattern =" ^/(_(profiler|wdt)|css|images|js)/"
70- security =false />
70+ security =" false" />
7171
7272 <firewall name =" default" >
7373 <anonymous />
@@ -81,7 +81,7 @@ configuration looks like this:
8181 $container->loadFromExtension('security', array(
8282 'providers' => array(
8383 'in_memory' => array(
84- 'memory' => array() ,
84+ 'memory' => null ,
8585 ),
8686 ),
8787 'firewalls' => array(
@@ -214,6 +214,8 @@ user to be logged in to access this URL:
214214 # ...
215215 firewalls :
216216 # ...
217+ default :
218+ # ...
217219
218220 access_control :
219221 # require ROLE_ADMIN for /admin*
@@ -236,10 +238,8 @@ user to be logged in to access this URL:
236238 <!-- ... -->
237239 </firewall >
238240
239- <access-control >
240- <!-- require ROLE_ADMIN for /admin* -->
241- <rule path =" ^/admin" role =" ROLE_ADMIN" />
242- </access-control >
241+ <!-- require ROLE_ADMIN for /admin* -->
242+ <rule path =" ^/admin" role =" ROLE_ADMIN" />
243243 </config >
244244 </srv : container >
245245
@@ -546,20 +546,23 @@ like this:
546546 http://symfony.com/schema/dic/services/services-1.0.xsd" >
547547
548548 <config >
549+ <!-- ... -->
550+
549551 <provider name =" in_memory" >
550552 <memory >
551553 <user name =" ryan" password =" $2a$12$LCY0MefVIEc3TYPHV9SNnuzOfyr2p/AXIGoQJEDs4am4JwhNz/jli" roles =" ROLE_USER" />
552554 <user name =" admin" password =" $2a$12$cyTWeE9kpq1PjqKFiWUZFuCRPwVyAZwm4XzMZ1qPUFl7/flCM3V0G" roles =" ROLE_ADMIN" />
553555 </memory >
554556 </provider >
555- <!-- ... -->
556557 </config >
557558 </srv : container >
558559
559560 .. code-block :: php
560561
561562 // app/config/security.php
562563 $container->loadFromExtension('security', array(
564+ // ...
565+
563566 'providers' => array(
564567 'in_memory' => array(
565568 'memory' => array(
@@ -699,8 +702,11 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
699702 # app/config/security.yml
700703 security :
701704 # ...
705+
702706 firewalls :
703707 # ...
708+ default :
709+ # ...
704710
705711 access_control :
706712 # require ROLE_ADMIN for /admin*
@@ -723,10 +729,8 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
723729 <!-- ... -->
724730 </firewall >
725731
726- <access-control >
727- <!-- require ROLE_ADMIN for /admin* -->
728- <rule path =" ^/admin" role =" ROLE_ADMIN" />
729- </access-control >
732+ <!-- require ROLE_ADMIN for /admin* -->
733+ <rule path =" ^/admin" role =" ROLE_ADMIN" />
730734 </config >
731735 </srv : container >
732736
@@ -735,6 +739,7 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
735739 // app/config/security.php
736740 $container->loadFromExtension('security', array(
737741 // ...
742+
738743 'firewalls' => array(
739744 // ...
<
9E88
code>740 745 'default' => array(
@@ -763,6 +768,7 @@ matches the URL.
763768 # app/config/security.yml
764769 security :
765770 # ...
771+
766772 access_control :
767773 - { path: ^/admin/users, roles: ROLE_SUPER_ADMIN }
768774 - { path: ^/admin, roles: ROLE_ADMIN }
@@ -779,10 +785,9 @@ matches the URL.
779785
780786 <config >
781787 <!-- ... -->
782- <access-control >
783- <rule path =" ^/admin/users" role =" ROLE_SUPER_ADMIN" />
784- <rule path =" ^/admin" role =" ROLE_ADMIN" />
785- </access-control >
788+
789+ <rule path =" ^/admin/users" role =" ROLE_SUPER_ADMIN" />
790+ <rule path =" ^/admin" role =" ROLE_ADMIN" />
786791 </config >
787792 </srv : container >
788793
@@ -791,6 +796,7 @@ matches the URL.
791796 // app/config/security.php
792797 $container->loadFromExtension('security', array(
793798 // ...
799+
794800 'access_control' => array(
795801 array('path' => '^/admin/users', 'role' => 'ROLE_SUPER_ADMIN'),
796802 array('path' => '^/admin', 'role' => 'ROLE_ADMIN'),
@@ -1106,13 +1112,14 @@ the firewall can handle this automatically for you when you activate the
11061112
11071113 # app/config/security.yml
11081114 security :
1115+ # ...
1116+
11091117 firewalls :
11101118 secured_area :
11111119 # ...
11121120 logout :
11131121 path : /logout
11141122 target : /
1115- # ...
11161123
11171124 .. code-block :: xml
11181125
@@ -1125,25 +1132,27 @@ the firewall can handle this automatically for you when you activate the
11251132 http://symfony.com/schema/dic/services/services-1.0.xsd" >
11261133
11271134 <config >
1128- <firewall name =" secured_area" pattern =" ^/" >
1135+ <!-- ... -->
1136+
1137+ <firewall name =" secured_area" >
11291138 <!-- ... -->
11301139 <logout path =" /logout" target =" /" />
11311140 </firewall >
1132- <!-- ... -->
11331141 </config >
11341142 </srv : container >
11351143
11361144 .. code-block :: php
11371145
11381146 // app/config/security.php
11391147 $container->loadFromExtension('security', array(
1148+ // ...
1149+
11401150 'firewalls' => array(
11411151 'secured_area' => array(
11421152 // ...
1143- 'logout' => array('path' => 'logout', 'target' => '/'),
1153+ 'logout' => array('path' => '/ logout', 'target' => '/'),
11441154 ),
11451155 ),
1146- // ...
11471156 ));
11481157
11491158 Next, you'll need to create a route for this URL (but not a controller):
@@ -1154,7 +1163,7 @@ Next, you'll need to create a route for this URL (but not a controller):
11541163
11551164 # app/config/routing.yml
11561165 logout :
1157- path : /logout
1166+ path : /logout
11581167
11591168 .. code-block :: xml
11601169
@@ -1175,7 +1184,7 @@ Next, you'll need to create a route for this URL (but not a controller):
11751184 use Symfony\Component\Routing\Route;
11761185
11771186 $collection = new RouteCollection();
1178- $collection->add('logout', new Route('/logout', array() ));
1187+ $collection->add('logout', new Route('/logout'));
11791188
11801189 return $collection;
11811190
@@ -1243,6 +1252,8 @@ rules by creating a role hierarchy:
12431252
12441253 # app/config/security.yml
12451254 security :
1255+ # ...
1256+
12461257 role_hierarchy :
12471258 ROLE_ADMIN : ROLE_USER
12481259 ROLE_SUPER_ADMIN : [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
@@ -1258,6 +1269,8 @@ rules by creating a role hierarchy:
12581269 http://symfony.com/schema/dic/services/services-1.0.xsd" >
12591270
12601271 <config >
1272+ <!-- ... -->
1273+
12611274 <role id =" ROLE_ADMIN" >ROLE_USER</role >
12621275 <role id =" ROLE_SUPER_ADMIN" >ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH</role >
12631276 </config >
@@ -1267,6 +1280,8 @@ rules by creating a role hierarchy:
12671280
12681281 // app/config/security.php
12691282 $container->loadFromExtension('security', array(
1283+ // ...
1284+
12701285 'role_hierarchy' => array(
12711286 'ROLE_ADMIN' => 'ROLE_USER',
12721287 'ROLE_SUPER_ADMIN' => array(
@@ -1296,6 +1311,8 @@ cookie will be ever created by Symfony):
12961311
12971312 # app/config/security.yml
12981313 security :
1314+ # ...
1315+
12991316 firewalls :
13001317 main :
13011318 http_basic : ~
@@ -1312,7 +1329,9 @@ cookie will be ever created by Symfony):
13121329 http://symfony.com/schema/dic/services/services-1.0.xsd" >
13131330
13141331 <config >
1315- <firewall stateless =" true" >
1332+ <!-- ... -->
1333+
1334+ <firewall name =" main" stateless =" true" >
13161335 <http-basic />
13171336 </firewall >
13181337 </config >
@@ -1322,8 +1341,10 @@ cookie will be ever created by Symfony):
13221341
13231342 // app/config/security.php
13241343 $container->loadFromExtension('security', array(
1344+ // ...
1345+
13251346 'firewalls' => array(
1326- 'main' => array('http_basic' => array() , 'stateless' => true),
1347+ 'main' => array('http_basic' => null , 'stateless' => true),
13271348 ),
13281349 ));
13291350
0 commit comments