Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit34e69de

Browse files
committed
[symfony#3533] Lots of nice changes thanks to@xabbuh
1 parent2fbf17c commit34e69de

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

‎cookbook/security/named_encoders.rst

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ How to Choose the Password Encoder Algorithm Dynamically
55
========================================================
66

77
..versionadded::2.5
8-
Named encoders were introduced in Symfony 2.5
8+
Named encoders were introduced in Symfony 2.5.
99

1010
Usually, the same password encoder is used for all users by configuring it
1111
to apply to all instances of a specific class:
@@ -19,12 +19,20 @@ to apply to all instances of a specific class:
1919
..code-block::xml
2020
2121
<!-- app/config/security.xml-->
22-
<config>
23-
<!-- ...-->
24-
<encoderclass="Symfony\Component\Security\Core\User\User"
25-
algorithm="sha512"
26-
/>
27-
</config>
22+
<?xml version="1.0" encoding="UTF-8"?>
23+
<srv:containerxmlns="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+
<encoderclass="Symfony\Component\Security\Core\User\User"
32+
algorithm="sha512"
33+
/>
34+
</config>
35+
</srv:container>
2836
2937
..code-block::php
3038
@@ -33,12 +41,12 @@ to apply to all instances of a specific class:
3341
// ...
3442
'encoders' => array(
3543
'Symfony\Component\Security\Core\User\User' => array(
36-
'algorithm'=> 'sha512',
44+
'algorithm' => 'sha512',
3745
),
3846
),
3947
));
4048
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
4250
you want to use dynamically.
4351

4452
In the previous example, you've set the ``sha512`` algorithm for ``Acme\UserBundle\Entity\User``.
@@ -63,7 +71,11 @@ named encoders:
6371
<!-- app/config/security.xml-->
6472
<?xml version="1.0" encoding="UTF-8" ?>
6573
<srv:containerxmlns="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+
>
6779
6880
<config>
6981
<!-- ...-->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp