@@ -244,6 +244,67 @@ also adjust the query parameter name via the ``parameter`` setting:
244244 ;
245245 };
246246
247+ Redirecting to a Specific Target Route
248+ --------------------------------------
249+
250+ ..versionadded ::6.2
251+
252+ The ``target_route `` configuration option was introduced in Symfony 6.2.
253+
254+ ..note ::
255+
256+ It works only in a stateful firewall.
257+
258+ This feature allows you to control the redirection target route via ``target_route ``.
259+
260+ ..configuration-block ::
261+
262+ ..code-block ::yaml
263+
264+ # config/packages/security.yaml
265+ security :
266+ # ...
267+
268+ firewalls :
269+ main :
270+ # ...
271+ switch_user :{ target_route: app_user_dashboard }
272+
273+ ..code-block ::xml
274+
275+ <!-- config/packages/security.xml-->
276+ <?xml version =" 1.0" encoding =" UTF-8" ?>
277+ <srv : container xmlns =" http://symfony.com/schema/dic/security"
278+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
279+ xmlns : srv =" http://symfony.com/schema/dic/services"
280+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
281+ https://symfony.com/schema/dic/services/services-1.0.xsd
282+ http://symfony.com/schema/dic/security
283+ https://symfony.com/schema/dic/security/security-1.0.xsd" >
284+ <config >
285+ <!-- ...-->
286+
287+ <firewall name =" main" >
288+ <!-- ...-->
289+ <switch-user target-route =" app_user_dashboard" />
290+ </firewall >
291+ </config >
292+ </srv : container >
293+
294+ ..code-block ::php
295+
296+ // config/packages/security.php
297+ use Symfony\Config\SecurityConfig;
298+
299+ return static function (SecurityConfig $security) {
300+ // ...
301+ $security->firewall('main')
302+ // ...
303+ ->switchUser()
304+ ->targetRoute('app_user_dashboard')
305+ ;
306+ };
307+
247308 Limiting User Switching
248309-----------------------
249310