#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile

This commit is contained in:
Antanas Arvasevicius 2017-03-01 14:16:35 +02:00 committed by Fabien Potencier
parent a6b20d1e5c
commit 6d23c8c41c
4 changed files with 69 additions and 3 deletions

View File

@ -509,7 +509,7 @@ class SecurityExtension extends Extension
// Parses a <provider> tag and returns the id for the related user provider service
private function createUserDaoProvider($name, $provider, ContainerBuilder $container)
{
$name = $this->getUserProviderId(strtolower($name));
$name = $this->getUserProviderId($name);
// Doctrine Entity and In-memory DAO provider are managed by factories
foreach ($this->userProviderFactories as $factory) {
@ -533,7 +533,7 @@ class SecurityExtension extends Extension
if (isset($provider['chain'])) {
$providers = array();
foreach ($provider['chain']['providers'] as $providerName) {
$providers[] = new Reference($this->getUserProviderId(strtolower($providerName)));
$providers[] = new Reference($this->getUserProviderId($providerName));
}
$container
@ -548,7 +548,7 @@ class SecurityExtension extends Extension
private function getUserProviderId($name)
{
return 'security.user.provider.concrete.'.$name;
return 'security.user.provider.concrete.'.strtolower($name);
}
private function createExceptionListener($container, $config, $id, $defaultEntryPoint, $stateless)

View File

@ -0,0 +1,16 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array(
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
);

View File

@ -0,0 +1,30 @@
imports:
- { resource: ./../config/framework.yml }
doctrine:
dbal:
driver: pdo_sqlite
memory: true
charset: UTF8
orm:
entity_managers:
default:
auto_mapping: true
security:
providers:
camelCasedName:
entity:
class: Symfony\Component\Security\Core\User\User
firewalls:
default:
anonymous: ~
provider: camelCasedName
encoders:
Symfony\Component\Security\Core\User\User: plaintext

View File

@ -0,0 +1,20 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
class CamelCasedProvidersCausesExceptionsTest extends WebTestCase
{
public function testBugfixExceptionThenCamelCasedProviderIsGiven()
{
$client = $this->createClient(array('test_case' => 'CamelCasedProviders', 'root_config' => 'config.yml'));
}
}