Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitcd900b6

Browse files
author
Robert Kopera
committed
[Security] added support for updated "distinguished name" format in x509 authentication
RFC 2253 (https://tools.ietf.org/html/rfc2253)issue:#31406
1 parent519ba3c commitcd900b6

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

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

Lines 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 ($request->server->has($this->credentialKey) && (
48+
preg_match('#/emailAddress=(.+\@.+\..+)(/|$)#',$request->server->get($this->credentialKey),$matches)
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‎

Lines 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-
publicfunctiontestGetPreAuthenticatedDataNoUser($emailAddress)
59+
publicfunctiontestGetPreAuthenticatedDataNoUser($emailAddress,$credentials)
6060
{
61-
$credentials ='CN=Sample certificate DN/emailAddress='.$emailAddress;
6261
$request =newRequest([], [], [], [], [], ['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
publicstaticfunctiondataProviderGetPreAuthenticatedDataNoUser()
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)

[8]ページ先頭

©2009-2025 Movatter.jp