Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed previous merges partially, there still seems to be a problem wi…
…th the test client
- Loading branch information
1 parent
d29715f
commit 46e5fa5
Showing
7 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...Bundle/Tests/Functional/Bundle/FormLoginBundle/DependencyInjection/FormLoginExtension.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,19 @@ | ||
<?php | ||
|
||
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
|
||
class FormLoginExtension extends Extension | ||
{ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$container | ||
->register('localized_form_failure_handler', 'Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Security\LocalizedFormFailureHandler') | ||
->addArgument(new Reference('router')) | ||
; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...tyBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.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,24 @@ | ||
<?php | ||
|
||
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Security; | ||
|
||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\Routing\RouterInterface; | ||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; | ||
|
||
class LocalizedFormFailureHandler implements AuthenticationFailureHandlerInterface | ||
{ | ||
private $router; | ||
|
||
public function __construct(RouterInterface $router) | ||
{ | ||
$this->router = $router; | ||
} | ||
|
||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception) | ||
{ | ||
return new RedirectResponse($this->router->generate('localized_login_path', array(), true)); | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
.../SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_form_failure_handler.yml
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,19 @@ | ||
imports: | ||
- { resource: ./../config/default.yml } | ||
|
||
security: | ||
encoders: | ||
Symfony\Component\Security\Core\User\User: plaintext | ||
|
||
providers: | ||
in_memory: | ||
users: | ||
johannes: { password: test, roles: [ROLE_USER] } | ||
|
||
firewalls: | ||
default: | ||
form_login: | ||
login_path: localized_login_path | ||
check_path: localized_check_path | ||
failure_handler: localized_form_failure_handler | ||
anonymous: ~ |
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