File tree Expand file tree Collapse file tree 1 file changed +49
-1
lines changed Expand file tree Collapse file tree 1 file changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,55 @@ as the value to the current URL:
76
76
.. tip ::
77
77
78
78
Instead of adding a ``_switch_user `` query string parameter, you can pass
79
- the username in a ``HTTP_X_SWITCH_USER `` header.
79
+ the username in a ``HTTP_X_SWITCH_USER `` header. You can use this feature by adjusting the ``parameter `` setting:
80
+
81
+ .. configuration-block ::
82
+
83
+ .. code-block :: yaml
84
+
85
+ # config/packages/security.yaml
86
+ security :
87
+ # ...
88
+
89
+ firewalls :
90
+ main :
91
+ # ...
92
+ switch_user : { parameter: HTTP_X_SWITCH_USER }
93
+
94
+ .. code-block :: xml
95
+
96
+ <!-- config/packages/security.xml -->
97
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
98
+ <srv : container xmlns =" http://symfony.com/schema/dic/security"
99
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
100
+ xmlns : srv =" http://symfony.com/schema/dic/services"
101
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
102
+ https://symfony.com/schema/dic/services/services-1.0.xsd
103
+ http://symfony.com/schema/dic/security
104
+ https://symfony.com/schema/dic/security/security-1.0.xsd" >
105
+ <config >
106
+ <!-- ... -->
107
+
108
+ <firewall name =" main" >
109
+ <!-- ... -->
110
+ <switch-user parameter =" HTTP_X_SWITCH_USER" />
111
+ </firewall >
112
+ </config >
113
+ </srv : container >
114
+
115
+ .. code-block :: php
116
+
117
+ // config/packages/security.php
118
+ use Symfony\Config\SecurityConfig;
119
+
120
+ return static function (SecurityConfig $security) {
121
+ // ...
122
+ $security->firewall('main')
123
+ // ...
124
+ ->switchUser()
125
+ ->parameter('HTTP_X_SWITCH_USER')
126
+ ;
127
+ };
80
128
81
129
To switch back to the original user, use the special ``_exit `` username:
82
130
You can’t perform that action at this time.
0 commit comments