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 6c9a204

Browse filesBrowse files
author
Maxime Douailin
committed
[Cookbook][Security] x509 doc for pre authenticated listeners
1 parent b00573c commit 6c9a204
Copy full SHA for 6c9a204

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+74
-0
lines changed

‎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
+73Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 webservers,
8+
including Apache. These modules generally set some environment variables
9+
that can be used to know which user is accessing your application. Out of the
10+
box, Symfony supports most authentication mecanisms.
11+
These are called *pre authenticated* requests because the user is already
12+
authenticated when reaching your application.
13+
14+
.. note::
15+
16+
An authentication provider will only inform the user provider of the username
17+
that made the request. You will need to either use an available
18+
:class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterface`
19+
or implement your own:
20+
21+
* :doc:`/cookbook/security/entity_provider`
22+
* :doc:`/cookbook/security/custom_provider`
23+
24+
X.509 Client certificate authentication
25+
---------------------------------------
26+
27+
When using client certificate, your webserver is doing all the authentication
28+
process itself. For Apache, on your VirtualHost, you may use the
29+
``SSLVerifyClient Require`` directive.
30+
31+
On your Symfony2 application security configuration, you can enable the x509
32+
authentication firewall:
33+
34+
.. configuration-block::
35+
36+
.. code-block:: yaml
37+
38+
# app/config/security.yml
39+
security:
40+
firewalls:
41+
secured_area:
42+
pattern: ^/
43+
x509:
44+
provider: your_user_provider
45+
46+
.. code-block:: xml
47+
48+
<!-- app/config/security.xml -->
49+
<config>
50+
<firewall name="secured_area" pattern="^/">
51+
<x509 provider="your_user_provider"/>
52+
</firewall>
53+
</config>
54+
55+
.. code-block:: php
56+
57+
// app/config/security.php
58+
$container->loadFromExtension('security', array(
59+
'firewalls' => array(
60+
'secured_area' => array(
61+
'pattern' => '^/'
62+
'x509' => array(
63+
'provider' => 'your_user_provider',
64+
),
65+
),
66+
),
67+
));
68+
69+
By default, the firewall will provide the ``SSL_CLIENT_S_DN_Email`` variable to
70+
your user provider, and set the ``SSL_CLIENT_S_DN`` as credentials in the
71+
:class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\PreAuthenticatedToken`.
72+
You can override these by setting respectively the ``user`` and the ``credentials`` keys
73+
in the x509 firewall configuration.

0 commit comments

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