Skip to content

Commit 1243383

Browse files
committed
Merge branch '2.3' into 2.5
* 2.3: Configure firewall's kernel exception listener with configured entry point or a default entry point PSR-2 fixes [DependencyInjection] make paths relative to __DIR__ in the generated container Fixed the syntax of a composer.json file Fixed the symfony/config version constraint Tweaked the password-compat version constraint Docblock fixes define constant only if it wasn't defined before Fix incorrect spanish translation Fixed typos Conflicts: composer.json src/Symfony/Bridge/Twig/TwigEngine.php src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php src/Symfony/Bundle/FrameworkBundle/Templating/Loader/FilesystemLoader.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php src/Symfony/Component/Console/Helper/TableHelper.php src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php src/Symfony/Component/Debug/ErrorHandler.php src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php src/Symfony/Component/HttpFoundation/Response.php src/Symfony/Component/HttpFoundation/StreamedResponse.php src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php src/Symfony/Component/HttpKernel/Fragment/RoutableFragmentRenderer.php src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php src/Symfony/Component/Process/Process.php src/Symfony/Component/Process/Tests/AbstractProcessTest.php src/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php src/Symfony/Component/Routing/Tests/Fixtures/validpattern.php src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php src/Symfony/Component/Security/composer.json src/Symfony/Component/Serializer/Encoder/XmlEncoder.php src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php src/Symfony/Component/Stopwatch/StopwatchEvent.php src/Symfony/Component/Stopwatch/StopwatchPeriod.php src/Symfony/Component/Templating/PhpEngine.php src/Symfony/Component/Templating/TemplateReference.php src/Symfony/Component/Templating/TemplateReferenceInterface.php src/Symfony/Component/Translation/TranslatorInterface.php src/Symfony/Component/Validator/ConstraintViolation.php src/Symfony/Component/Validator/ExecutionContextInterface.php src/Symfony/Component/Validator/Mapping/ClassMetadata.php src/Symfony/Component/Validator/MetadataFactoryInterface.php
2 parents d4428cf + d667a2d commit 1243383

File tree

7 files changed

+33
-8
lines changed

7 files changed

+33
-8
lines changed

DataCollector/SecurityDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function collect(Request $request, Response $response, \Exception $except
6565
/**
6666
* Checks if security is enabled.
6767
*
68-
* @return bool true if security is enabled, false otherwise
68+
* @return bool true if security is enabled, false otherwise
6969
*/
7070
public function isEnabled()
7171
{
@@ -95,7 +95,7 @@ public function getRoles()
9595
/**
9696
* Checks if the user is authenticated or not.
9797
*
98-
* @return bool true if the user is authenticated, false otherwise
98+
* @return bool true if the user is authenticated, false otherwise
9999
*/
100100
public function isAuthenticated()
101101
{

DependencyInjection/Security/Factory/AbstractFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint
146146
*
147147
* @param array $config
148148
*
149-
* @return bool Whether a possibly configured RememberMeServices should be set for this listener
149+
* @return bool Whether a possibly configured RememberMeServices should be set for this listener
150150
*/
151151
protected function isRememberMeAware($config)
152152
{

DependencyInjection/SecurityExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
350350
}
351351

352352
// Determine default entry point
353-
$defaultEntryPoint = isset($firewall['entry_point']) ? $firewall['entry_point'] : null;
353+
$configuredEntryPoint = isset($firewall['entry_point']) ? $firewall['entry_point'] : null;
354354

355355
// Authentication listeners
356-
list($authListeners, $defaultEntryPoint) = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $defaultEntryPoint);
356+
list($authListeners, $defaultEntryPoint) = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $configuredEntryPoint);
357357

358358
$listeners = array_merge($listeners, $authListeners);
359359

@@ -366,7 +366,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
366366
$listeners[] = new Reference('security.access_listener');
367367

368368
// Exception listener
369-
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $defaultEntryPoint));
369+
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint));
370370

371371
return array($matcher, $listeners, $exceptionListener);
372372
}

Templating/Helper/LogoutUrlHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public function getLogoutUrl($key)
8888
/**
8989
* Generates the logout URL for the firewall.
9090
*
91-
* @param string $key The firewall key
92-
* @param bool|string $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
91+
* @param string $key The firewall key
92+
* @param bool|string $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
9393
*
9494
* @return string The logout URL
9595
*

Tests/Functional/FirewallEntryPointTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ public function testItUsesTheConfiguredEntryPointWhenUsingUnknownCredentials()
3535
);
3636
}
3737

38+
public function testItUsesTheConfiguredEntryPointFromTheExceptionListenerWithFormLoginAndNoCredentials()
39+
{
40+
$client = $this->createClient(array('test_case' => 'FirewallEntryPoint', 'root_config' => 'config_form_login.yml'));
41+
$client->insulate();
42+
43+
$client->request('GET', '/secure/resource');
44+
45+
$this->assertEquals(
46+
EntryPointStub::RESPONSE_TEXT,
47+
$client->getResponse()->getContent(),
48+
"Custom entry point wasn't started"
49+
);
50+
}
51+
3852
protected function setUp()
3953
{
4054
parent::setUp();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
imports:
2+
- { resource: ./config.yml }
3+
4+
security:
5+
firewalls:
6+
secure:
7+
pattern: ^/
8+
form_login:
9+
check_path: /login_check

Twig/Extension/LogoutUrlExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function getFunctions()
4747
* Generate the relative logout URL for the firewall.
4848
*
4949
* @param string $key The firewall key
50+
*
5051
* @return string The relative logout URL
5152
*/
5253
public function getLogoutPath($key)
@@ -58,6 +59,7 @@ public function getLogoutPath($key)
5859
* Generate the absolute logout URL for the firewall.
5960
*
6061
* @param string $key The firewall key
62+
*
6163
* @return string The absolute logout URL
6264
*/
6365
public function getLogoutUrl($key)

0 commit comments

Comments
 (0)