Fix typo in the check_path validator
This commit is contained in:
parent
5f7219e2ab
commit
51022c30ae
|
@ -283,7 +283,7 @@ class MainConfiguration implements ConfigurationInterface
|
|||
continue;
|
||||
}
|
||||
|
||||
if (false !== strpos('/', $firewall[$k]['check_path']) && !preg_match('#'.$firewall['pattern'].'#', $firewall[$k]['check_path'])) {
|
||||
if (false !== strpos($firewall[$k]['check_path'], '/') && !preg_match('#'.$firewall['pattern'].'#', $firewall[$k]['check_path'])) {
|
||||
throw new \LogicException(sprintf('The check_path "%s" for login method "%s" is not matched by the firewall pattern "%s".', $firewall[$k]['check_path'], $k, $firewall['pattern']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
$container->loadFromExtension('security', array(
|
||||
'providers' => array(
|
||||
'default' => array('id' => 'foo'),
|
||||
),
|
||||
|
||||
'firewalls' => array(
|
||||
'some_firewall' => array(
|
||||
'pattern' => '/secured_area/.*',
|
||||
'form_login' => array(
|
||||
'check_path' => '/some_area/login_check',
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/security"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<provider name="default" id="foo" />
|
||||
|
||||
<firewall name="some_firewall" pattern="/secured_area/.*">
|
||||
<form-login check-path="/some_area/login_check" />
|
||||
</firewall>
|
||||
</config>
|
||||
|
||||
</srv:container>
|
|
@ -0,0 +1,9 @@
|
|||
security:
|
||||
providers:
|
||||
default: { id: foo }
|
||||
|
||||
firewalls:
|
||||
some_firewall:
|
||||
pattern: /secured_area/.*
|
||||
form_login:
|
||||
check_path: /some_area/login_check
|
|
@ -184,6 +184,15 @@ abstract class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('foo', (string) $container->getAlias('security.acl.provider'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
* @expectedExceptionMessage not matched by the firewall pattern
|
||||
*/
|
||||
public function testInvalidCheckPath()
|
||||
{
|
||||
$container = $this->getContainer('invalid_check_path');
|
||||
}
|
||||
|
||||
protected function getContainer($file)
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
|
Reference in New Issue