Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
1fcdbef8
Commit
1fcdbef8
authored
Jun 26, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made the form authentication listener reusable when creating a custom authentication listener
parent
1e2218f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
src/Silex/Provider/SecurityServiceProvider.php
src/Silex/Provider/SecurityServiceProvider.php
+12
-9
No files found.
src/Silex/Provider/SecurityServiceProvider.php
View file @
1fcdbef8
...
...
@@ -33,7 +33,6 @@ use Symfony\Component\Security\Core\Role\RoleHierarchy;
use
Symfony\Component\Security\Http\Firewall
;
use
Symfony\Component\Security\Http\FirewallMap
;
use
Symfony\Component\Security\Http\Firewall\AccessListener
;
use
Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener
;
use
Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener
;
use
Symfony\Component\Security\Http\Firewall\LogoutListener
;
use
Symfony\Component\Security\Http\Firewall\SwitchUserListener
;
...
...
@@ -331,19 +330,23 @@ class SecurityServiceProvider implements ServiceProviderInterface
});
});
$app
[
'security.authentication_listener.form._proto'
]
=
$app
->
protect
(
function
(
$providerKey
,
$options
)
use
(
$app
,
$that
)
{
return
$app
->
share
(
function
()
use
(
$app
,
$providerKey
,
$options
,
$that
)
{
$that
->
addFakeRoute
(
array
(
'post'
,
$tmp
=
isset
(
$options
[
'check_path'
])
?
$options
[
'check_path'
]
:
'/login_check'
,
str_replace
(
'/'
,
'_'
,
ltrim
(
$tmp
,
'/'
))));
$app
[
'security.authentication_listener.form._proto'
]
=
$app
->
protect
(
function
(
$name
,
$options
,
$class
=
null
)
use
(
$app
,
$that
)
{
return
$app
->
share
(
function
()
use
(
$app
,
$name
,
$options
,
$that
,
$class
)
{
$that
->
addFakeRoute
(
array
(
'match'
,
$tmp
=
isset
(
$options
[
'check_path'
])
?
$options
[
'check_path'
]
:
'/login_check'
,
str_replace
(
'/'
,
'_'
,
ltrim
(
$tmp
,
'/'
))));
if
(
null
===
$class
)
{
$class
=
'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener'
;
}
return
new
UsernamePasswordFormAuthenticationListener
(
return
new
$class
(
$app
[
'security'
],
$app
[
'security.authentication_manager'
],
$app
[
'security.session_strategy'
],
isset
(
$app
[
'security.session_strategy.'
.
$name
])
?
$app
[
'security.session_strategy.'
.
$name
]
:
$app
[
'security.session_strategy'
],
$app
[
'security.http_utils'
],
$
providerKey
,
$
name
,
$options
,
null
,
// AuthenticationSuccessHandlerInterface
null
,
// AuthenticationFailureHandlerInterface
isset
(
$app
[
'security.authentication.success_handler.'
.
$name
])
?
$app
[
'security.authentication.success_handler.'
.
$name
]
:
null
,
isset
(
$app
[
'security.authentication.failure_handler.'
.
$name
])
?
$app
[
'security.authentication.failure_handler.'
.
$name
]
:
null
,
$app
[
'logger'
],
$app
[
'dispatcher'
],
isset
(
$options
[
'with_csrf'
])
&&
$options
[
'with_csrf'
]
&&
isset
(
$app
[
'form.csrf_provider'
])
?
$app
[
'form.csrf_provider'
]
:
null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment