[Security/Http] fix parsing X509 emailAddress
This commit is contained in:
parent
03f2adcb4e
commit
fceb86bde6
@ -46,7 +46,7 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener
|
|||||||
$user = $request->server->get($this->userKey);
|
$user = $request->server->get($this->userKey);
|
||||||
} elseif (
|
} elseif (
|
||||||
$request->server->has($this->credentialKey)
|
$request->server->has($this->credentialKey)
|
||||||
&& preg_match('#emailAddress=(.+\@.+\.[^,/]+)($|,|/)#', $request->server->get($this->credentialKey), $matches)
|
&& preg_match('#emailAddress=([^,/@]++@[^,/]++)#', $request->server->get($this->credentialKey), $matches)
|
||||||
) {
|
) {
|
||||||
$user = $matches[1];
|
$user = $matches[1];
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ class X509AuthenticationListenerTest extends TestCase
|
|||||||
yield ['cert+something@example.com', 'CN=Sample certificate DN,emailAddress=cert+something@example.com'];
|
yield ['cert+something@example.com', 'CN=Sample certificate DN,emailAddress=cert+something@example.com'];
|
||||||
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com,CN=Sample certificate DN'];
|
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com,CN=Sample certificate DN'];
|
||||||
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com'];
|
yield ['cert+something@example.com', 'emailAddress=cert+something@example.com'];
|
||||||
|
yield ['firstname.lastname@mycompany.co.uk', 'emailAddress=firstname.lastname@mycompany.co.uk,CN=Firstname.Lastname,OU=london,OU=company design and engineering,OU=Issuer London,OU=Roaming,OU=Interactive,OU=Users,OU=Standard,OU=Business,DC=england,DC=core,DC=company,DC=co,DC=uk'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPreAuthenticatedDataNoData()
|
public function testGetPreAuthenticatedDataNoData()
|
||||||
|
Reference in New Issue
Block a user