@@ -77,7 +77,9 @@ Each part will be explained in the next section.
77
77
access_denied_handler : some.service.id
78
78
entry_point : some.service.id
79
79
provider : name
80
- context : name
80
+ # manages where each firewall stores session information
81
+ # See "Firewall Context" below for more details
82
+ context : context_key
81
83
stateless : false
82
84
x509 :
83
85
provider : name
@@ -213,6 +215,66 @@ Redirecting after Login
213
215
* ``target_path_parameter `` (type: ``string ``, default: ``_target_path ``)
214
216
* ``use_referer `` (type: ``Boolean ``, default: ``false ``)
215
217
218
+ .. _reference-security-firewall-context :
219
+
220
+ Firewall Context
221
+ ----------------
222
+
223
+ Most applications will only need one :ref: `firewall<book-security-firewalls> `.
224
+ But if your application *does * use multiple firewalls, you'll notice that
225
+ if you're authenticated in one firewall, you're not automatically authenticated
226
+ in another. In other words, the systems don't share a common "context": each
227
+ firewall acts like a separate security system.
228
+
229
+ However, each firewall has an optional ``context `` key (which defaults to
230
+ the name of the firewall), which is used when storing and retrieving security
231
+ data to and from the session. If this key were set to the same value across
232
+ multiple firewalls, the "context" could actually be shared:
233
+
234
+ .. configuration-block ::
235
+
236
+ .. code-block :: yaml
237
+
238
+ # app/config/security.yml
239
+ security :
240
+ # ...
241
+
242
+ firewalls :
243
+ somename :
244
+ # ...
245
+ context : my_context
246
+ othername :
247
+ # ...
248
+ context : my_context
249
+
250
+ .. code-block :: xml
251
+
252
+ <!-- app/config/security.xml -->
253
+ <security : config >
254
+ <firewall name =" somename" context =" my_context" >
255
+ <! ... ->
256
+ </firewall >
257
+ <firewall name =" othername" context =" my_context" >
258
+ <! ... ->
259
+ </firewall >
260
+ </security : config >
261
+
262
+ .. code-block :: php
263
+
264
+ // app/config/security.php
265
+ $container->loadFromExtension('security', array(
266
+ 'firewalls' => array(
267
+ 'somename' => array(
268
+ // ...
269
+ 'context' => 'my_context'
270
+ ),
271
+ 'othername' => array(
272
+ // ...
273
+ 'context' => 'my_context'
274
+ ),
275
+ ),
276
+ ));
277
+
216
278
HTTP-Digest Authentication
217
279
--------------------------
218
280
0 commit comments