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
35d771bb
Commit
35d771bb
authored
Jun 22, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplified the code
parent
c3342c67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
20 deletions
+10
-20
src/Silex/Provider/SecurityServiceProvider.php
src/Silex/Provider/SecurityServiceProvider.php
+10
-20
No files found.
src/Silex/Provider/SecurityServiceProvider.php
View file @
35d771bb
...
...
@@ -121,16 +121,22 @@ class SecurityServiceProvider implements ServiceProviderInterface
$entryPoint
=
$type
==
'http'
?
'http'
:
'form'
;
$app
[
'security.authentication.factory.'
.
$type
]
=
$app
->
protect
(
function
(
$name
,
$options
)
use
(
$type
,
$app
,
$entryPoint
)
{
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
]
=
$app
[
'security.authentication.factory._proto'
](
$name
,
$options
,
$type
,
$entryPoint
);
if
(
!
isset
(
$app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]))
{
$app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]
=
$app
[
'security.entry_point.'
.
$entryPoint
.
'._proto'
](
$name
);
}
if
(
!
isset
(
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
]))
{
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
]
=
$app
[
'security.authentication.'
.
$type
.
'._proto'
](
$name
,
$options
);
}
return
array
(
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
],
$
entryPoint
);
return
array
(
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
],
$
app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]
);
});
}
$app
[
'security.firewall_map'
]
=
$app
->
share
(
function
()
use
(
$app
)
{
$map
=
new
FirewallMap
();
$entryPoint
=
'form'
;
foreach
(
$app
[
'security.firewalls'
]
as
$name
=>
$firewall
)
{
$entryPoint
=
'form'
;
$pattern
=
isset
(
$firewall
[
'pattern'
])
?
$firewall
[
'pattern'
]
:
null
;
$users
=
isset
(
$firewall
[
'users'
])
?
$firewall
[
'users'
]
:
array
();
unset
(
$firewall
[
'pattern'
],
$firewall
[
'users'
]);
...
...
@@ -284,15 +290,11 @@ class SecurityServiceProvider implements ServiceProviderInterface
});
$app
[
'security.exception_listener._proto'
]
=
$app
->
protect
(
function
(
$entryPoint
,
$name
)
use
(
$app
)
{
if
(
!
isset
(
$app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]))
{
$app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]
=
$app
[
'security.entry_point.'
.
$entryPoint
.
'._proto'
](
$name
);
}
return
new
ExceptionListener
(
$app
[
'security'
],
$app
[
'security.trust_resolver'
],
$app
[
'security.http_utils'
],
$
app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]
,
$
entryPoint
,
null
,
// errorPage
null
,
// AccessDeniedHandlerInterface
$app
[
'logger'
]
...
...
@@ -385,18 +387,6 @@ class SecurityServiceProvider implements ServiceProviderInterface
$app
[
'security.authentication_provider.anonymous._proto'
]
=
$app
->
protect
(
function
(
$name
)
use
(
$app
)
{
return
new
AnonymousAuthenticationProvider
(
$name
);
});
$app
[
'security.authentication.factory._proto'
]
=
$app
->
protect
(
function
(
$name
,
$options
,
$type
,
$entryPoint
=
'form'
)
use
(
$app
)
{
if
(
!
isset
(
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
]))
{
if
(
!
isset
(
$app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]))
{
$app
[
'security.entry_point.'
.
$entryPoint
.
'.'
.
$name
]
=
$app
[
'security.entry_point.'
.
$entryPoint
.
'._proto'
](
$name
);
}
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
]
=
$app
[
'security.authentication.'
.
$type
.
'._proto'
](
$name
,
$options
);
}
return
$app
[
'security.authentication.'
.
$name
.
'.'
.
$type
];
});
}
public
function
boot
(
Application
$app
)
...
...
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