Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit db48945

Browse filesBrowse files
committed
Merge branch '2.4' into 2.5
Conflicts: changelog.rst
2 parents 5b8df28 + cd3d7cf commit db48945
Copy full SHA for db48945

File tree

Expand file treeCollapse file tree

3 files changed

+78
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+78
-0
lines changed

‎cookbook/map.rst.inc

Copy file name to clipboardExpand all lines: cookbook/map.rst.inc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
* :doc:`/cookbook/security/custom_password_authenticator`
148148
* :doc:`/cookbook/security/api_key_authentication`
149149
* :doc:`/cookbook/security/custom_authentication_provider`
150+
* :doc:`/cookbook/security/pre_authenticated`
150151
* :doc:`/cookbook/security/target_path`
151152
* :doc:`/cookbook/security/csrf_in_login_form`
152153
* :doc:`/cookbook/security/named_encoders`

‎cookbook/security/index.rst

Copy file name to clipboardExpand all lines: cookbook/security/index.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Security
2121
custom_password_authenticator
2222
api_key_authentication
2323
custom_authentication_provider
24+
pre_authenticated
2425
target_path
2526
csrf_in_login_form
2627
named_encoders
+76Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.. index::
2+
single: Security; Pre authenticated providers
3+
4+
Using pre Authenticated Security Firewalls
5+
==========================================
6+
7+
A lot of authentication modules are already provided by some web servers,
8+
including Apache. These modules generally set some environment variables
9+
that can be used to determine which user is accessing your application. Out of the
10+
box, Symfony supports most authentication mechanisms.
11+
These requests are called *pre authenticated* requests because the user is already
12+
authenticated when reaching your application.
13+
14+
X.509 Client Certificate Authentication
15+
---------------------------------------
16+
17+
When using client certificates, your webserver is doing all the authentication
18+
process itself. With Apache, for example, you would use the
19+
``SSLVerifyClient Require`` directive.
20+
21+
Enable the x509 authentication for a particular firewall in the security configuration:
22+
23+
.. configuration-block::
24+
25+
.. code-block:: yaml
26+
27+
# app/config/security.yml
28+
security:
29+
firewalls:
30+
secured_area:
31+
pattern: ^/
32+
x509:
33+
provider: your_user_provider
34+
35+
.. code-block:: xml
36+
37+
<?xml version="1.0" ?>
38+
<!-- app/config/security.xml -->
39+
<srv:container xmlns="http://symfony.com/schema/dic/security"
40+
xmlns:srv="http://symfony.com/schema/dic/services">
41+
42+
<config>
43+
<firewall name="secured_area" pattern="^/">
44+
<x509 provider="your_user_provider"/>
45+
</firewall>
46+
</config>
47+
</srv:container>
48+
49+
.. code-block:: php
50+
51+
// app/config/security.php
52+
$container->loadFromExtension('security', array(
53+
'firewalls' => array(
54+
'secured_area' => array(
55+
'pattern' => '^/'
56+
'x509' => array(
57+
'provider' => 'your_user_provider',
58+
),
59+
),
60+
),
61+
));
62+
63+
By default, the firewall provides the ``SSL_CLIENT_S_DN_Email`` variable to
64+
the user provider, and sets the ``SSL_CLIENT_S_DN`` as credentials in the
65+
:class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\PreAuthenticatedToken`.
66+
You can override these by setting the ``user`` and the ``credentials`` keys
67+
in the x509 firewall configuration respectively.
68+
69+
.. note::
70+
71+
An authentication provider will only inform the user provider of the username
72+
that made the request. You will need to create (or use) a "user provider" that
73+
turns that username into a User object of your choice:
74+
75+
* :doc:`/cookbook/security/custom_provider`
76+
* :doc:`/cookbook/security/entity_provider`

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.