@@ -66,6 +66,8 @@ the user provider, and sets the ``SSL_CLIENT_S_DN`` as credentials in the
66
66
You can override these by setting the ``user `` and the ``credentials `` keys
67
67
in the x509 firewall configuration respectively.
68
68
69
+ .. _cookbook-security-pre-authenticated-user-provider-note :
70
+
69
71
.. note ::
70
72
71
73
An authentication provider will only inform the user provider of the username
@@ -76,4 +78,66 @@ in the x509 firewall configuration respectively.
76
78
provider, see:
77
79
78
80
* :doc: `/cookbook/security/custom_provider `
79
- * :doc: `/cookbook/security/entity_provider `
81
+ * :doc: `/cookbook/security/entity_provider `
82
+
83
+ REMOTE_USER based Authentication
84
+ --------------------------------
85
+
86
+ .. versionadded :: 2.6
87
+ REMOTE_USER pre authenticated firewall was introduced in Symfony 2.6.
88
+
89
+ A lot of authentication modules, like ``auth_kerb` for Apache provide the username
90
+ using the ``REMOTE_USER `` environment variable. This variable can be trusted by
91
+ the application since the authentication happened before the request reached it.
92
+
93
+ To configure Symfony using the ``REMOTE_USER` environment variable, simply enable the
94
+ corresponding firewall in your security configuration:
95
+
96
+ .. configuration-block::
97
+
98
+ .. code-block:: yaml
99
+
100
+ # app/config/security.yml
101
+ security:
102
+ firewalls:
103
+ secured_area:
104
+ pattern: ^/
105
+ remote_user:
106
+ provider: your_user_provider
107
+
108
+ .. code-block:: xml
109
+
110
+ <?xml version="1.0" ?>
111
+ <!-- app/config/security.xml -->
112
+ <srv:container xmlns="http://symfony.com/schema/dic/security"
113
+ xmlns:srv="http://symfony.com/schema/dic/services">
114
+
115
+ <config>
116
+ <firewall name="secured_area" pattern="^/">
117
+ <remote-user provider="your_user_provider"/>
118
+ </firewall>
119
+ </config>
120
+ </srv:container>
121
+
122
+ .. code-block:: php
123
+
124
+ // app/config/security.php
125
+ $container->loadFromExtension('security', array(
126
+ 'firewalls' => array(
127
+ 'secured_area' => array(
128
+ 'pattern' => '^/'
129
+ 'remote_user' => array(
130
+ 'provider' => 'your_user_provider',
131
+ ),
132
+ ),
133
+ ),
134
+ ));
135
+
136
+ The firewall will then provide the ``REMOTE_USER `` environment variable to
137
+ your user provider. You can change the variable name used by setting the ``user ``
138
+ key in the ``remote_user `` firewall configuration.
139
+
140
+ .. note ::
141
+
142
+ Just like for X509 authentication, you will need to configure a "user provider".
143
+ See :ref: `the note about it <cookbook-security-pre-authenticated-user-provider-note >`.
0 commit comments