@@ -5,7 +5,7 @@ How to Choose the Password Encoder Algorithm Dynamically
5
5
========================================================
6
6
7
7
.. versionadded :: 2.5
8
- Named encoders were introduced in Symfony 2.5
8
+ Named encoders were introduced in Symfony 2.5.
9
9
10
10
Usually, the same password encoder is used for all users by configuring it
11
11
to apply to all instances of a specific class:
@@ -19,12 +19,20 @@ to apply to all instances of a specific class:
19
19
.. code-block :: xml
20
20
21
21
<!-- app/config/security.xml -->
22
- <config >
23
- <!-- ... -->
24
- <encoder class =" Symfony\Component\Security\Core\User\User"
25
- algorithm =" sha512"
26
- />
27
- </config >
22
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
23
+ <srv : container xmlns =" http://symfony.com/schema/dic/security"
24
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
25
+ xmlns : srv =" http://symfony.com/schema/dic/services"
26
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
27
+ http://symfony.com/schema/dic/services/services-1.0.xsd"
28
+ >
29
+ <config >
30
+ <!-- ... -->
31
+ <encoder class =" Symfony\Component\Security\Core\User\User"
32
+ algorithm =" sha512"
33
+ />
34
+ </config >
35
+ </srv : container >
28
36
29
37
.. code-block :: php
30
38
@@ -33,12 +41,12 @@ to apply to all instances of a specific class:
33
41
// ...
34
42
'encoders' => array(
35
43
'Symfony\Component\Security\Core\User\User' => array(
36
- 'algorithm' => 'sha512',
44
+ 'algorithm' => 'sha512',
37
45
),
38
46
),
39
47
));
40
48
41
- Another option is to use a "named" encoder, and then select which encoder
49
+ Another option is to use a "named" encoder and then select which encoder
42
50
you want to use dynamically.
43
51
44
52
In the previous example, you've set the ``sha512 `` algorithm for ``Acme\UserBundle\Entity\User ``.
@@ -63,7 +71,11 @@ named encoders:
63
71
<!-- app/config/security.xml -->
64
72
<?xml version =" 1.0" encoding =" UTF-8" ?>
65
73
<srv : container xmlns =" http://symfony.com/schema/dic/security"
66
- xmlns : srv =" http://symfony.com/schema/dic/services" >
74
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
75
+ xmlns : srv =" http://symfony.com/schema/dic/services"
76
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
77
+ http://symfony.com/schema/dic/services/services-1.0.xsd"
78
+ >
67
79
68
80
<config >
69
81
<!-- ... -->
0 commit comments