-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[SecurityBundle] Fix valid provider considered undefined #24132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
24 changes: 24 additions & 0 deletions
24
...ymfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/firewall_provider.php
This file contains hidden or 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 | ||
|
||
$container->loadFromExtension('security', array( | ||
'providers' => array( | ||
'default' => array( | ||
'memory' => $memory = array( | ||
'users' => array('foo' => array('password' => 'foo', 'roles' => 'ROLE_USER')), | ||
), | ||
), | ||
'with-dash' => array( | ||
'memory' => $memory, | ||
), | ||
), | ||
'firewalls' => array( | ||
'main' => array( | ||
'provider' => 'default', | ||
'form_login' => true, | ||
), | ||
'other' => array( | ||
'provider' => 'with-dash', | ||
'form_login' => true, | ||
), | ||
), | ||
)); |
16 changes: 16 additions & 0 deletions
16
...ymfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/listener_provider.php
This file contains hidden or 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,16 @@ | ||
<?php | ||
|
||
$container->loadFromExtension('security', array( | ||
'providers' => array( | ||
'default' => array( | ||
'memory' => array( | ||
'users' => array('foo' => array('password' => 'foo', 'roles' => 'ROLE_USER')), | ||
), | ||
), | ||
), | ||
'firewalls' => array( | ||
'main' => array( | ||
'form_login' => array('provider' => 'default'), | ||
), | ||
), | ||
)); |
20 changes: 20 additions & 0 deletions
20
...ymfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/firewall_provider.xml
This file contains hidden or 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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:sec="http://symfony.com/schema/dic/security" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<sec:config> | ||
<sec:providers> | ||
<sec:provider name="with-dash" id="foo" /> | ||
</sec:providers> | ||
|
||
<sec:firewalls> | ||
<sec:firewall name="main" provider="with-dash"> | ||
<sec:form_login /> | ||
</sec:firewall> | ||
</sec:firewalls> | ||
</sec:config> | ||
|
||
</container> |
20 changes: 20 additions & 0 deletions
20
...ymfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/listener_provider.xml
This file contains hidden or 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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:sec="http://symfony.com/schema/dic/security" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<sec:config> | ||
<sec:providers> | ||
<sec:provider name="default" id="foo" /> | ||
</sec:providers> | ||
|
||
<sec:firewalls> | ||
<sec:firewall name="main"> | ||
<sec:form_login provider="default" /> | ||
</sec:firewall> | ||
</sec:firewalls> | ||
</sec:config> | ||
|
||
</container> |
16 changes: 16 additions & 0 deletions
16
...ymfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/firewall_provider.yml
This file contains hidden or 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,16 @@ | ||
security: | ||
providers: | ||
default: | ||
memory: | ||
users: { foo: { password: foo, roles: ROLE_USER } } | ||
with-dash: | ||
memory: | ||
users: { foo: { password: foo, roles: ROLE_USER } } | ||
|
||
firewalls: | ||
main: | ||
provider: default | ||
form_login: true | ||
other: | ||
provider: with-dash | ||
form_login: true |
10 changes: 10 additions & 0 deletions
10
...ymfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/listener_provider.yml
This file contains hidden or 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,10 @@ | ||
security: | ||
providers: | ||
default: | ||
memory: | ||
users: { foo: { password: foo, roles: ROLE_USER } } | ||
|
||
firewalls: | ||
main: | ||
form_login: | ||
provider: default |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by now i think the conversion should happen in
getUserProviderId
actually 🤔 and simply make the check below$userProvider
. That would be more robust.sorry :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about BC :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point is we create a different id 2 lines above by passing
$name
as is tocreateUserDaoProvider
.. that looks weird.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get your point but yes, changing this is not fine regarding BC. Note also that when using a custom provider (specifying
my_provider: { id: some_service }
),createUserDaoProvider
returns thesome_service
id, it doesn't rely ongetUserProviderId
. Let's avoid any behavior change here, not the right moment for that :)I'm going to review this part of the extension in 2.7 once this merged, I believe there are some bugs. Right now, 3.4's security setup is broken, this covers all edge cases and makes it work again. I would like to quickly move on and polish afterwards if needed.
Btw, thanks for your review, it was useful actually.