-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Security] Added remote_user firewall info and documentation for pre authenticated firewalls #3912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
34ad1b5
8465d46
86ba188
be0d866
b8a0eb2
e6aa733
f36c45e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,8 @@ the user provider, and sets the ``SSL_CLIENT_S_DN`` as credentials in the | |
You can override these by setting the ``user`` and the ``credentials`` keys | ||
in the x509 firewall configuration respectively. | ||
|
||
.. _cookbook-security-pre-authenticated-user-provider-note: | ||
|
||
.. note:: | ||
|
||
An authentication provider will only inform the user provider of the username | ||
|
@@ -76,4 +78,66 @@ in the x509 firewall configuration respectively. | |
provider, see: | ||
|
||
* :doc:`/cookbook/security/custom_provider` | ||
* :doc:`/cookbook/security/entity_provider` | ||
* :doc:`/cookbook/security/entity_provider` | ||
|
||
REMOTE_USER based Authentication | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Based" should be uppercased. |
||
-------------------------------- | ||
|
||
.. versionadded:: 2.6 | ||
REMOTE_USER pre authenticated firewall was introduced in Symfony 2.6. | ||
|
||
A lot of authentication modules, like ``auth_kerb` for Apache provide the username | ||
using the ``REMOTE_USER`` environment variable. This variable can be trusted by | ||
the application since the authentication happened before the request reached it. | ||
|
||
To configure Symfony using the ``REMOTE_USER` environment variable, simply enable the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing backtick here (spotted by the Travis build) |
||
corresponding firewall in your security configuration: | ||
|
||
.. configuration-block:: | ||
|
||
.. code-block:: yaml | ||
|
||
# app/config/security.yml | ||
security: | ||
firewalls: | ||
secured_area: | ||
pattern: ^/ | ||
remote_user: | ||
provider: your_user_provider | ||
|
||
.. code-block:: xml | ||
|
||
<?xml version="1.0" ?> | ||
<!-- app/config/security.xml --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please swap the two lines above |
||
<srv:container xmlns="http://symfony.com/schema/dic/security" | ||
xmlns:srv="http://symfony.com/schema/dic/services"> | ||
|
||
<config> | ||
<firewall name="secured_area" pattern="^/"> | ||
<remote-user provider="your_user_provider"/> | ||
</firewall> | ||
</config> | ||
</srv:container> | ||
|
||
.. code-block:: php | ||
|
||
// app/config/security.php | ||
$container->loadFromExtension('security', array( | ||
'firewalls' => array( | ||
'secured_area' => array( | ||
'pattern' => '^/' | ||
'remote_user' => array( | ||
'provider' => 'your_user_provider', | ||
), | ||
), | ||
), | ||
)); | ||
|
||
The firewall will then provide the ``REMOTE_USER`` environment variable to | ||
your user provider. You can change the variable name used by setting the ``user`` | ||
key in the ``remote_user`` firewall configuration. | ||
|
||
.. note:: | ||
|
||
Just like for X509 authentication, you will need to configure a "user provider". | ||
See :ref:`the note about it <cookbook-security-pre-authenticated-user-provider-note>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate empty line