@@ -67,7 +67,7 @@ configuration looks like this:
|
67 | 67 |
|
68 | 68 | <firewall name="dev"
|
69 | 69 | pattern="^/(_(profiler|wdt)|css|images|js)/"
|
70 |
| -security=false /> |
| 70 | +security="false" /> |
71 | 71 |
|
72 | 72 | <firewall name="default">
|
73 | 73 | <anonymous />
|
@@ -81,7 +81,7 @@ configuration looks like this:
|
81 | 81 | $container->loadFromExtension('security', array(
|
82 | 82 | 'providers' => array(
|
83 | 83 | 'in_memory' => array(
|
84 |
| -'memory' => array(), |
| 84 | +'memory' => null, |
85 | 85 | ),
|
86 | 86 | ),
|
87 | 87 | 'firewalls' => array(
|
@@ -214,6 +214,8 @@ user to be logged in to access this URL:
|
214 | 214 | # ...
|
215 | 215 | firewalls:
|
216 | 216 | # ...
|
| 217 | +default: |
| 218 | +# ... |
217 | 219 |
|
218 | 220 | access_control:
|
219 | 221 | # require ROLE_ADMIN for /admin*
|
@@ -236,10 +238,8 @@ user to be logged in to access this URL:
|
236 | 238 | <!-- ... -->
|
237 | 239 | </firewall>
|
238 | 240 |
|
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" /> |
243 | 243 | </config>
|
244 | 244 | </srv:container>
|
245 | 245 |
|
@@ -546,20 +546,23 @@ like this:
|
546 | 546 | http://symfony.com/schema/dic/services/services-1.0.xsd">
|
547 | 547 |
|
548 | 548 | <config>
|
| 549 | +<!-- ... --> |
| 550 | +
|
549 | 551 | <provider name="in_memory">
|
550 | 552 | <memory>
|
551 | 553 | <user name="ryan" password="$2a$12$LCY0MefVIEc3TYPHV9SNnuzOfyr2p/AXIGoQJEDs4am4JwhNz/jli" roles="ROLE_USER" />
|
552 | 554 | <user name="admin" password="$2a$12$cyTWeE9kpq1PjqKFiWUZFuCRPwVyAZwm4XzMZ1qPUFl7/flCM3V0G" roles="ROLE_ADMIN" />
|
553 | 555 | </memory>
|
554 | 556 | </provider>
|
555 |
| -<!-- ... --> |
556 | 557 | </config>
|
557 | 558 | </srv:container>
|
558 | 559 |
|
559 | 560 | .. code-block:: php
|
560 | 561 |
|
561 | 562 | // app/config/security.php
|
562 | 563 | $container->loadFromExtension('security', array(
|
| 564 | +// ... |
| 565 | +
|
563 | 566 | 'providers' => array(
|
564 | 567 | 'in_memory' => array(
|
565 | 568 | 'memory' => array(
|
@@ -699,8 +702,11 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
|
699 | 702 | # app/config/security.yml
|
700 | 703 | security:
|
701 | 704 | # ...
|
| 705 | +
|
702 | 706 | firewalls:
|
703 | 707 | # ...
|
| 708 | +default: |
| 709 | +# ... |
704 | 710 |
|
705 | 711 | access_control:
|
706 | 712 | # require ROLE_ADMIN for /admin*
|
@@ -723,10 +729,8 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
|
723 | 729 | <!-- ... -->
|
724 | 730 | </firewall>
|
725 | 731 |
|
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" /> |
730 | 734 | </config>
|
731 | 735 | </srv:container>
|
732 | 736 |
|
@@ -735,6 +739,7 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
|
735 | 739 | // app/config/security.php
|
736 | 740 | $container->loadFromExtension('security', array(
|
737 | 741 | // ...
|
| 742 | +
|
738 | 743 | 'firewalls' => array(
|
739 | 744 | // ...
|
740 | 745 | 'default' => array(
|
@@ -763,6 +768,7 @@ matches the URL.
|
763 | 768 | # app/config/security.yml
|
764 | 769 | security:
|
765 | 770 | # ...
|
| 771 | +
|
766 | 772 | access_control:
|
767 | 773 | - { path: ^/admin/users, roles: ROLE_SUPER_ADMIN }
|
768 | 774 | - { path: ^/admin, roles: ROLE_ADMIN }
|
@@ -779,10 +785,9 @@ matches the URL.
|
779 | 785 |
|
780 | 786 | <config>
|
781 | 787 | <!-- ... -->
|
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" /> |
786 | 791 | </config>
|
787 | 792 | </srv:container>
|
788 | 793 |
|
@@ -791,6 +796,7 @@ matches the URL.
|
791 | 796 | // app/config/security.php
|
792 | 797 | $container->loadFromExtension('security', array(
|
793 | 798 | // ...
|
| 799 | +
|
794 | 800 | 'access_control' => array(
|
795 | 801 | array('path' => '^/admin/users', 'role' => 'ROLE_SUPER_ADMIN'),
|
796 | 802 | array('path' => '^/admin', 'role' => 'ROLE_ADMIN'),
|
@@ -1106,13 +1112,14 @@ the firewall can handle this automatically for you when you activate the
|
1106 | 1112 |
|
1107 | 1113 | # app/config/security.yml
|
1108 | 1114 | security:
|
| 1115 | +# ... |
| 1116 | +
|
1109 | 1117 | firewalls:
|
1110 | 1118 | secured_area:
|
1111 | 1119 | # ...
|
1112 | 1120 | logout:
|
1113 | 1121 | path: /logout
|
1114 | 1122 | target: /
|
1115 |
| -# ... |
1116 | 1123 |
|
1117 | 1124 | .. code-block:: xml
|
1118 | 1125 |
|
@@ -1125,25 +1132,27 @@ the firewall can handle this automatically for you when you activate the
|
1125 | 1132 | http://symfony.com/schema/dic/services/services-1.0.xsd">
|
1126 | 1133 |
|
1127 | 1134 | <config>
|
1128 |
| -<firewall name="secured_area" pattern="^/"> |
| 1135 | +<!-- ... --> |
| 1136 | +
|
| 1137 | +<firewall name="secured_area"> |
1129 | 1138 | <!-- ... -->
|
1130 | 1139 | <logout path="/logout" target="/" />
|
1131 | 1140 | </firewall>
|
1132 |
| -<!-- ... --> |
1133 | 1141 | </config>
|
1134 | 1142 | </srv:container>
|
1135 | 1143 |
|
1136 | 1144 | .. code-block:: php
|
1137 | 1145 |
|
1138 | 1146 | // app/config/security.php
|
1139 | 1147 | $container->loadFromExtension('security', array(
|
| 1148 | +// ... |
| 1149 | +
|
1140 | 1150 | 'firewalls' => array(
|
1141 | 1151 | 'secured_area' => array(
|
1142 | 1152 | // ...
|
1143 |
| -'logout' => array('path' => 'logout', 'target' => '/'), |
| 1153 | +'logout' => array('path' => '/logout', 'target' => '/'), |
1144 | 1154 | ),
|
1145 | 1155 | ),
|
1146 |
| -// ... |
1147 | 1156 | ));
|
1148 | 1157 |
|
1149 | 1158 | 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):
|
1154 | 1163 |
|
1155 | 1164 | # app/config/routing.yml
|
1156 | 1165 | logout:
|
1157 |
| -path: /logout |
| 1166 | +path: /logout |
1158 | 1167 |
|
1159 | 1168 | .. code-block:: xml
|
1160 | 1169 |
|
@@ -1175,7 +1184,7 @@ Next, you'll need to create a route for this URL (but not a controller):
|
1175 | 1184 | use Symfony\Component\Routing\Route;
|
1176 | 1185 |
|
1177 | 1186 | $collection = new RouteCollection();
|
1178 |
| -$collection->add('logout', new Route('/logout', array())); |
| 1187 | +$collection->add('logout', new Route('/logout')); |
1179 | 1188 |
|
1180 | 1189 | return $collection;
|
1181 | 1190 |
|
@@ -1243,6 +1252,8 @@ rules by creating a role hierarchy:
|
1243 | 1252 |
|
1244 | 1253 | # app/config/security.yml
|
1245 | 1254 | security:
|
| 1255 | +# ... |
| 1256 | +
|
1246 | 1257 | role_hierarchy:
|
1247 | 1258 | ROLE_ADMIN: ROLE_USER
|
1248 | 1259 | ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
|
@@ -1258,6 +1269,8 @@ rules by creating a role hierarchy:
|
1258 | 1269 | http://symfony.com/schema/dic/services/services-1.0.xsd">
|
1259 | 1270 |
|
1260 | 1271 | <config>
|
| 1272 | +<!-- ... --> |
| 1273 | +
|
1261 | 1274 | <role id="ROLE_ADMIN">ROLE_USER</role>
|
1262 | 1275 | <role id="ROLE_SUPER_ADMIN">ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH</role>
|
1263 | 1276 | </config>
|
@@ -1267,6 +1280,8 @@ rules by creating a role hierarchy:
|
1267 | 1280 |
|
1268 | 1281 | // app/config/security.php
|
1269 | 1282 | $container->loadFromExtension('security', array(
|
| 1283 | +// ... |
| 1284 | +
|
1270 | 1285 | 'role_hierarchy' => array(
|
1271 | 1286 | 'ROLE_ADMIN' => 'ROLE_USER',
|
1272 | 1287 | 'ROLE_SUPER_ADMIN' => array(
|
@@ -1296,6 +1311,8 @@ cookie will be ever created by Symfony):
|
1296 | 1311 |
|
1297 | 1312 | # app/config/security.yml
|
1298 | 1313 | security:
|
| 1314 | +# ... |
| 1315 | +
|
1299 | 1316 | firewalls:
|
1300 | 1317 | main:
|
1301 | 1318 | http_basic: ~
|
@@ -1312,7 +1329,9 @@ cookie will be ever created by Symfony):
|
1312 | 1329 | http://symfony.com/schema/dic/services/services-1.0.xsd">
|
1313 | 1330 |
|
1314 | 1331 | <config>
|
1315 |
| -<firewall stateless="true"> |
| 1332 | +<!-- ... --> |
| 1333 | +
|
| 1334 | +<firewall name="main" stateless="true"> |
1316 | 1335 | <http-basic />
|
1317 | 1336 | </firewall>
|
1318 | 1337 | </config>
|
@@ -1322,8 +1341,10 @@ cookie will be ever created by Symfony):
|
1322 | 1341 |
|
1323 | 1342 | // app/config/security.php
|
1324 | 1343 | $container->loadFromExtension('security', array(
|
| 1344 | +// ... |
| 1345 | +
|
1325 | 1346 | 'firewalls' => array(
|
1326 |
| -'main' => array('http_basic' => array(), 'stateless' => true), |
| 1347 | +'main' => array('http_basic' => null, 'stateless' => true), |
1327 | 1348 | ),
|
1328 | 1349 | ));
|
1329 | 1350 |
|
|
0 commit comments