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 bdbac2c

Browse filesBrowse files
Robert Koperafabpot
authored andcommitted
[Security] added support for updated \"distinguished name\" format in x509 authentication
1 parent 0797ef2 commit bdbac2c
Copy full SHA for bdbac2c

File tree

Expand file treeCollapse file tree

2 files changed

+11
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-7
lines changed

‎src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ protected function getPreAuthenticatedData(Request $request)
4444
$user = null;
4545
if ($request->server->has($this->userKey)) {
4646
$user = $request->server->get($this->userKey);
47-
} elseif ($request->server->has($this->credentialKey) && preg_match('#/emailAddress=(.+\@.+\..+)(/|$)#', $request->server->get($this->credentialKey), $matches)) {
47+
} elseif (
48+
$request->server->has($this->credentialKey)
49+
&& preg_match('#emailAddress=(.+\@.+\.[^,/]+)($|,|/)#', $request->server->get($this->credentialKey), $matches)
50+
) {
4851
$user = $matches[1];
4952
}
5053

‎src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ public static function dataProviderGetPreAuthenticatedData()
5656
/**
5757
* @dataProvider dataProviderGetPreAuthenticatedDataNoUser
5858
*/
59-
public function testGetPreAuthenticatedDataNoUser($emailAddress)
59+
public function testGetPreAuthenticatedDataNoUser($emailAddress, $credentials)
6060
{
61-
$credentials = 'CN=Sample certificate DN/emailAddress='.$emailAddress;
6261
$request = new Request([], [], [], [], [], ['SSL_CLIENT_S_DN' => $credentials]);
6362

6463
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
@@ -76,10 +75,12 @@ public function testGetPreAuthenticatedDataNoUser($emailAddress)
7675

7776
public static function dataProviderGetPreAuthenticatedDataNoUser()
7877
{
79-
return [
80-
'basicEmailAddress' => ['cert@example.com'],
81-
'emailAddressWithPlusSign' => ['cert+something@example.com'],
82-
];
78+
yield ['cert@example.com', 'CN=Sample certificate DN/emailAddress=cert@example.com'];
79+
yield ['cert+something@example.com', 'CN=Sample certificate DN/emailAddress=cert+something@example.com'];
80+
yield ['cert@example.com', 'CN=Sample certificate DN,emailAddress=cert@example.com'];
81+
yield ['cert+something@example.com', 'CN=Sample certificate DN,emailAddress=cert+something@example.com'];
82+
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com,CN=Sample certificate DN'];
83+
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com'];
8384
}
8485

8586
/**

0 commit comments

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