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
c3342c67
Commit
c3342c67
authored
Jun 22, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added an exception when the authentication type is not registered
parent
9ab6ee63
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
src/Silex/Provider/SecurityServiceProvider.php
src/Silex/Provider/SecurityServiceProvider.php
+6
-4
tests/Silex/Tests/Provider/SecurityServiceProviderTest.php
tests/Silex/Tests/Provider/SecurityServiceProviderTest.php
+18
-0
No files found.
src/Silex/Provider/SecurityServiceProvider.php
View file @
c3342c67
...
...
@@ -163,12 +163,14 @@ class SecurityServiceProvider implements ServiceProviderInterface
$options
=
array
();
}
if
(
isset
(
$app
[
'security.authentication.factory.'
.
$type
]))
{
if
(
!
isset
(
$app
[
'security.authentication.factory.'
.
$type
]))
{
throw
new
\LogicException
(
sprintf
(
'The "%s" authentication entry is not registered.'
,
$type
));
}
list
(
$listener
,
$entryPoint
)
=
$app
[
'security.authentication.factory.'
.
$type
](
$name
,
$options
);
$listeners
[]
=
$listener
;
}
}
$listeners
[]
=
$app
[
'security.access_listener'
];
...
...
tests/Silex/Tests/Provider/SecurityServiceProviderTest.php
View file @
c3342c67
...
...
@@ -32,6 +32,24 @@ class SecurityServiceProviderTest extends WebTestCase
}
}
/**
* @expectedException \LogicException
*/
public
function
testWrongAuthenticationType
()
{
$app
=
new
Application
();
$app
->
register
(
new
SecurityServiceProvider
(),
array
(
'security.firewalls'
=>
array
(
'wrong'
=>
array
(
'foobar'
=>
true
,
'users'
=>
array
(),
),
),
));
$app
->
get
(
'/'
,
function
()
{});
$app
->
handle
(
Request
::
create
(
'/'
));
}
public
function
testFormAuthentication
()
{
$app
=
$this
->
createApplication
(
'form'
);
...
...
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