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 1702133

Browse filesBrowse files
committed
feature #3913 [Cookbook][Security] Added doc for x509 pre authenticated listener (zefrog)
This PR was merged into the 2.3 branch. Discussion ---------- [Cookbook][Security] Added doc for x509 pre authenticated listener | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | - This can be merged in 2.3. Regards. Commits ------- 57cc957 full xml config, pushed the note at the end of the entry 01d18fe fixing last issues in pre_authenticated cookbook entry 83c40e9 Corrected pre_authenticated cookbook entry f5a6d58 Added pre_authenticated to map.rst 6c9a204 [Cookbook][Security] x509 doc for pre authenticated listeners
2 parents 36337e7 + 57cc957 commit 1702133
Copy full SHA for 1702133

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
@@ -138,6 +138,7 @@
138138
* :doc:`/cookbook/security/securing_services`
139139
* :doc:`/cookbook/security/custom_provider`
140140
* :doc:`/cookbook/security/custom_authentication_provider`
141+
* :doc:`/cookbook/security/pre_authenticated`
141142
* :doc:`/cookbook/security/target_path`
142143
* :doc:`/cookbook/security/csrf_in_login_form`
143144

‎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
@@ -16,5 +16,6 @@ Security
1616
securing_services
1717
custom_provider
1818
custom_authentication_provider
19+
pre_authenticated
1920
target_path
2021
csrf_in_login_form
+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.