File tree Expand file tree Collapse file tree 3 files changed +42
-24
lines changed Expand file tree Collapse file tree 3 files changed +42
-24
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,23 @@ The end result is exactly the same as before - the difference is only in
227
227
to look for parameters with those names. When the container is built, it
228
228
looks up the value of each parameter and uses it in the service definition.
229
229
230
+ .. versionadded :: 2.1
231
+ Escaping the ``@ `` character in YAML parameter values is new in Symfony 2.1.9
232
+ and Symfony 2.2.1.
233
+
234
+ .. note ::
235
+
236
+ If you want to use a string that starts with an ``@ `` sign as a parameter
237
+ value (i.e. a very safe mailer password) in a yaml file, you need to escape
238
+ it by adding another ``@ `` sign (This only applies to the YAML format):
239
+
240
+ .. code-block :: yaml
241
+
242
+ # app/config/parameters.yml
243
+ parameters :
244
+ # This will be parsed as string "@securepass"
245
+ mailer_password : " @@securepass"
246
+
230
247
The purpose of parameters is to feed information into services. Of course
231
248
there was nothing wrong with defining the service without using any parameters.
232
249
Parameters, however, have several advantages:
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ How to change the Default Target Path Behavior
5
5
==============================================
6
6
7
7
By default, the security component retains the information of the last request
8
- URI in a session variable named ``_security.target_path ``. Upon a successful
9
- login, the user is redirected to this path, as to help her continue from
10
- the last known page she visited.
8
+ URI in a session variable named ``_security.main.target_path `` (with ``main `` being
9
+ the name of the firewall, defined in ``security.yml ``). Upon a successful
10
+ login, the user is redirected to this path, as to help her continue from the
11
+ last known page she visited.
11
12
12
13
On some occasions, this is unexpected. For example when the last request
13
14
URI was an HTTP POST against a route which is configured to allow only a POST
@@ -61,7 +62,7 @@ Next, create your own ``ExceptionListener``::
61
62
return;
62
63
}
63
64
64
- $request->getSession()->set('_security.target_path', $request->getUri());
65
+ $request->getSession()->set('_security.main. target_path', $request->getUri());
65
66
}
66
67
}
67
68
Original file line number Diff line number Diff line change @@ -64,34 +64,34 @@ Each part will be explained in the next section.
64
64
iterations : 1000
65
65
66
66
# Example options/values for what a custom encoder might look like
67
- Acme\Your\Class\Name :
68
- algorithm : ~
69
- ignore_case : false
70
- encode_as_base64 : true
71
- iterations : 5000
72
- id : ~
67
+ Acme\DemoBundle\Entity\User3 :
68
+ id : my.encoder.id
73
69
74
70
providers : # Required
75
71
# Examples:
76
- memory :
77
- name : memory
78
- users :
79
- foo :
80
- password : foo
81
- roles : ROLE_USER
82
- bar :
83
- password : bar
84
- roles : [ROLE_USER, ROLE_ADMIN]
85
- entity :
72
+ my_in_memory_provider :
73
+ memory :
74
+ users :
75
+ foo :
76
+ password : foo
77
+ roles : ROLE_USER
78
+ bar :
79
+ password : bar
80
+ roles : [ROLE_USER, ROLE_ADMIN]
81
+
82
+ my_entity_provider :
86
83
entity :
87
- class : SecurityBundle:User
88
- property : username
84
+ class : SecurityBundle:User
85
+ property : username
89
86
90
87
# Example custom provider
91
- some_custom_provider :
88
+ my_some_custom_provider :
92
89
id : ~
90
+
91
+ # Chain some providers
92
+ my_chain_provider :
93
93
chain :
94
- providers : [ ]
94
+ providers : [ my_in_memory_provider, my_entity_provider ]
95
95
96
96
firewalls : # Required
97
97
# Examples:
You can’t perform that action at this time.
0 commit comments