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

Commitd070f5b

Browse files
author
Iltar van der Berg
committed
Updated according to the feature modifications
Instead of multiple User Checkers, only 1 is configured
1 parent2a85e4f commitd070f5b

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

‎cookbook/security/user_checkers.rst

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ How to Create and Enable Custom User Checkers
55
=============================================
66

77
During the authentication of a user, additional checks might be required to verify
8-
if the identified user is allowed to log in. By defining custom usercheckers, you
9-
can define per firewall whichcheckers should be used.
8+
if the identified user is allowed to log in. By definingacustom userchecker, you
9+
can define per firewall whichchecker should be used.
1010

1111
..versionadded::2.8
12-
Addingcustom usercheckers was introduced in Symfony 2.8.
12+
Defining acustom userchecker was introduced in Symfony 2.8.
1313

1414

1515
Creating a Custom User Checker
@@ -80,8 +80,7 @@ other service:
8080
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
8181
8282
<services>
83-
<serviceid="app.user_checker"class="App\Security\UserChecker">
84-
</service>
83+
<serviceid="app.user_checker"class="App\Security\UserChecker" />
8584
</services>
8685
</container>
8786
@@ -107,7 +106,7 @@ is the service id of your user checker:
107106
firewalls:
108107
secured_area:
109108
pattern:^/
110-
user_checkers:["app.user_checker"]
109+
user_checker:app.user_checker
111110
# ...
112111
113112
..code-block::xml
@@ -123,7 +122,7 @@ is the service id of your user checker:
123122
<config>
124123
<!-- ...-->
125124
<firewallname="secured_area"pattern="^/">
126-
<user-checkers>app.user_checker</user-checkers>
125+
<user-checker>app.user_checker</user-checker>
127126
<!-- ...-->
128127
</firewall>
129128
</config>
@@ -138,7 +137,7 @@ is the service id of your user checker:
138137
'firewalls' => array(
139138
'secured_area' => array(
140139
'pattern' => '^/',
141-
'user_checkers' =>array('app.user_checker'),
140+
'user_checker' => 'app.user_checker',
142141
// ...
143142
),
144143
),
@@ -148,10 +147,7 @@ is the service id of your user checker:
148147
Additional Configurations
149148
-------------------------
150149

151-
It's possible to add multiple user checkers to one firewall while
152-
configuring only one user checker for another firewall. When adding
153-
multiple user checkers, they are executed in the same sequence as
154-
defined in your configuration.
150+
It's possible to have a different user checker per firewall.
155151

156152
..configuration-block::
157153

@@ -164,11 +160,11 @@ defined in your configuration.
164160
firewalls:
165161
admin:
166162
pattern:^/admin
167-
user_checkers:["app.user_checker", "app.admin_checker"]
163+
user_checker:app.admin_user_checker
168164
# ...
169165
secured_area:
170166
pattern:^/
171-
user_checkers:["app.user_checker"]
167+
user_checker:app.user_checker
172168
173169
..code-block::xml
174170
@@ -183,12 +179,11 @@ defined in your configuration.
183179
<config>
184180
<!-- ...-->
185181
<firewallname="admin"pattern="^/admin">
186-
<user-checkers>app.user_checker</user-checkers>
187-
<user-checkers>app.admin_checker</user-checkers>
182+
<user-checker>app.admin_user_checker</user-checker>
188183
<!-- ...-->
189184
</firewall>
190185
<firewallname="secured_area"pattern="^/">
191-
<user-checkers>app.user_checker</user-checkers>
186+
<user-checker>app.user_checker</user-checker>
192187
<!-- ...-->
193188
</firewall>
194189
</config>
@@ -203,16 +198,18 @@ defined in your configuration.
203198
'firewalls' => array(
204199
'admin' => array(
205200
'pattern' => '^/admin',
206-
'user_checkers' => array(
207-
'app.user_checker',
208-
'app.admin_checker',
209-
),
201+
'user_checkers' => 'app.admin_user_checker'
210202
// ...
211203
),
212204
'secured_area' => array(
213205
'pattern' => '^/',
214-
'user_checkers' =>array('app.user_checker'),
206+
'user_checker' => 'app.user_checker',
215207
// ...
216208
),
217209
),
218210
));
211+
212+
..note::
213+
214+
Internally the user checkers are aliased per firewall. For `secured_area` the alias
215+
`security.user_checker.secured_area` would point to `app.user_checker`.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp