Skip to content

Commit 4b52d34

Browse files
committed
minor #17582 [Security] X509 user_identifier parameter (Spomky)
This PR was merged into the 6.3 branch. Discussion ---------- [Security] X509 `user_identifier` parameter See #17580 **❓ Question**: I am not sure about the PHP configuration `->user_identifier('emailAddress')`? Should I create the corresponding method or is it guessed by the `SecurityConfig` object? Commits ------- 405a740 ``user_identifier`` parameter documentation
2 parents 776b282 + 405a740 commit 4b52d34

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

reference/configuration/security.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ X.509 Authentication
666666
provider: your_user_provider
667667
user: SSL_CLIENT_S_DN_Email
668668
credentials: SSL_CLIENT_S_DN
669+
user_identifier: emailAddress
669670
670671
.. code-block:: xml
671672
@@ -687,6 +688,7 @@ X.509 Authentication
687688
<x509 provider="your_user_provider"
688689
user="SSL_CLIENT_S_DN_Email"
689690
credentials="SSL_CLIENT_S_DN"
691+
user_identifier="emailAddress"
690692
/>
691693
</firewall>
692694
</config>
@@ -703,6 +705,7 @@ X.509 Authentication
703705
->provider('your_user_provider')
704706
->user('SSL_CLIENT_S_DN_Email')
705707
->credentials('SSL_CLIENT_S_DN')
708+
->user_identifier('emailAddress')
706709
;
707710
};
708711
@@ -723,7 +726,18 @@ If the ``user`` parameter is not available, the name of the ``$_SERVER``
723726
parameter containing the full "distinguished name" of the certificate
724727
(exposed by e.g. Nginx).
725728

726-
Symfony identifies the value following ``emailAddress=`` in this parameter.
729+
By default, Symfony identifies the value following ``emailAddress=`` in this parameter.
730+
This can be changed using the ``user_identifier`` parameter.
731+
732+
user_identifier
733+
...........
734+
735+
**type**: ``string`` **default**: ``emailAddress``
736+
737+
The ``user_identifier`` parameter is used to find the user identifier in the
738+
"distinguished name" e.g. ``Subject: C=FR, O=My Organization, CN=user1, emailAddress=user1@myorg.fr``.
739+
740+
By setting this parameter to ``CN``, the returned user identifier will be the "Common Name" ``user1``
727741

728742
.. _reference-security-firewall-remote-user:
729743

security.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,11 +1314,11 @@ ways:
13141314
#. First, it tries the ``SSL_CLIENT_S_DN_Email`` server parameter, which is
13151315
exposed by Apache;
13161316
#. If it is not set (e.g. when using Nginx), it uses ``SSL_CLIENT_S_DN`` and
1317-
matches the value following ``emailAddress=``.
1317+
matches the value following ``emailAddress``.
13181318

1319-
You can customize the name of both parameters under the ``x509`` key. See
1320-
:ref:`the configuration reference <reference-security-firewall-x509>` for
1321-
more details.
1319+
You can customize the name of the three parameters under the ``x509`` key.
1320+
See :ref:`the configuration reference <reference-security-firewall-x509>`
1321+
for more details.
13221322

13231323
Remote Users
13241324
~~~~~~~~~~~~

0 commit comments

Comments
 (0)