-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 6.0: [SecurityBundle] Fix using same handler for multiple authenticators [DependencyInjection] Fix dump order of inlined deps [VarExporter] Fix exporting enums [HttpClient] Let curl handle content-length headers [Intl] Fix tests
- Loading branch information
Showing
8 changed files
with
171 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Tests/Functional/Bundle/AuthenticatorBundle/AuthenticatorBundle.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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\Bundle\AuthenticatorBundle; | ||
|
||
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class AuthenticatorBundle extends Bundle | ||
{ | ||
public function build(ContainerBuilder $container) | ||
{ | ||
parent::build($container); | ||
|
||
$this->configureSecurityExtension($container); | ||
} | ||
|
||
private function configureSecurityExtension(ContainerBuilder $container): void | ||
{ | ||
/** @var SecurityExtension $extension */ | ||
$extension = $container->getExtension('security'); | ||
|
||
$extension->addAuthenticatorFactory(new DummyFormLoginFactory()); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
Tests/Functional/Bundle/AuthenticatorBundle/DummyFormLoginFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?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\Bundle\AuthenticatorBundle; | ||
|
||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FormLoginFactory; | ||
use Symfony\Component\DependencyInjection\ChildDefinition; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
class DummyFormLoginFactory extends FormLoginFactory | ||
{ | ||
public function getKey(): string | ||
{ | ||
return 'dummy_form_login'; | ||
} | ||
|
||
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string | ||
{ | ||
$authenticatorId = 'security.authenticator.dummy_form_login.'.$firewallName; | ||
$options = array_intersect_key($config, $this->options); | ||
$authenticator = $container | ||
->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.form_login')) | ||
->replaceArgument(1, new Reference($userProviderId)) | ||
->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container, $firewallName, $config))) | ||
->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container, $firewallName, $config))) | ||
->replaceArgument(4, $options); | ||
|
||
if ($options['use_forward'] ?? false) { | ||
$authenticator->addMethodCall('setHttpKernel', [new Reference('http_kernel')]); | ||
} | ||
|
||
return $authenticatorId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
imports: | ||
- { resource: ./config.yml } | ||
- { resource: ./security.yml } | ||
|
||
security: | ||
enable_authenticator_manager: true | ||
firewalls: | ||
firewall1: | ||
pattern: /firewall1 | ||
provider: in_memory | ||
entry_point: form_login | ||
form_login: | ||
check_path: /firewall1/login | ||
success_handler: success_handler | ||
failure_handler: failure_handler | ||
default_target_path: /firewall1/test | ||
login_path: /firewall1/login | ||
dummy_form_login: | ||
check_path: /firewall1/dummy_login | ||
success_handler: success_handler | ||
failure_handler: failure_handler | ||
default_target_path: /firewall1/dummy | ||
login_path: /firewall1/dummy_login | ||
|
||
services: | ||
success_handler: | ||
class: Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler | ||
arguments: | ||
- '@security.http_utils' | ||
failure_handler: | ||
class: Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler | ||
arguments: | ||
- '@http_kernel' | ||
- '@security.http_utils' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters