|
1 | 1 | How to Use multiple User Providers
|
2 | 2 | ==================================
|
3 | 3 |
|
4 |
| -Each authentication mechanism (e.g. HTTP Authentication, form login, etc) |
5 |
| -uses exactly one user provider, and will use the first declared user provider |
6 |
| -by default. But what if you want to specify a few users via configuration |
7 |
| -and the rest of your users in the database? This is possible by creating |
8 |
| -a new provider that chains the two together: |
| 4 | +Each authentication mechanism (e.g. HTTP Authentication, form login, etc.) uses |
| 5 | +exactly one user provider. But what if you want to specify a few users via |
| 6 | +configuration and the rest of your users in the database? This is possible by |
| 7 | +creating a new provider that chains the two together: |
9 | 8 |
|
10 | 9 | .. configuration-block::
|
11 | 10 |
|
@@ -82,20 +81,12 @@ a new provider that chains the two together:
|
82 | 81 | ),
|
83 | 82 | ));
|
84 | 83 |
|
85 |
| -Now, all firewalls that explicitly define ``chain_provider`` as their user |
86 |
| -provider will, in turn, try to load the user from both the ``in_memory`` and |
87 |
| -``user_db`` providers. |
88 |
| - |
89 |
| -.. versionadded:: 3.4 |
90 |
| - In previous Symfony versions, firewalls that didn't define their user provider |
91 |
| - explicitly, used the first existing provider (``chain_provider`` in this |
92 |
| - example). However, auto-selecting the first user provider has been deprecated |
93 |
| - in Symfony 3.4 and will throw an exception in 4.0. Always define the provider |
94 |
| - used by the firewall when there are multiple providers. |
| 84 | +Now, all firewalls that define ``chain_provider`` as their user provider will, |
| 85 | +in turn, try to load the user from both the ``in_memory`` and ``user_db`` |
| 86 | +providers. |
95 | 87 |
|
96 | 88 | You can also configure the firewall or individual authentication mechanisms
|
97 |
| -to use a specific provider. Again, unless a provider is specified explicitly, |
98 |
| -the first provider is always used: |
| 89 | +to use a specific provider: |
99 | 90 |
|
100 | 91 | .. configuration-block::
|
101 | 92 |
|
@@ -151,10 +142,10 @@ the first provider is always used:
|
151 | 142 | ),
|
152 | 143 | ));
|
153 | 144 |
|
154 |
| -In this example, if a user tries to log in via HTTP authentication, the authentication |
155 |
| -system will use the ``in_memory`` user provider. But if the user tries to |
156 |
| -log in via the form login, the ``user_db`` provider will be used (since it's |
157 |
| -the default for the firewall as a whole). |
| 145 | +In this example, if a user tries to log in via HTTP authentication, the |
| 146 | +authentication system will use the ``in_memory`` user provider. But if the user |
| 147 | +tries to log in via the form login, the ``user_db`` provider will be used (since |
| 148 | +it's the default for the firewall as a whole). |
158 | 149 |
|
159 | 150 | For more information about user provider and firewall configuration, see
|
160 | 151 | the :doc:`/reference/configuration/security`.
|
0 commit comments