Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[SecurityBundle] Deprecate auto picking the first provider #24378

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 1 commit into from
Sep 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 UPGRADE-3.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ SecurityBundle

* Deprecated the HTTP digest authentication: `HttpDigestFactory` will be removed in 4.0.
Use another authentication system like `http_basic` instead.

* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
Using the first configured provider is deprecated since 3.4 and will throw an exception on 4.0.
Explicitly configure the provider to use on your firewalls.

Translation
-----------
Expand Down
4 changes: 4 additions & 0 deletions 4 UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,10 @@ SecurityBundle

* Removed the HTTP digest authentication system. The `HttpDigestFactory` class
has been removed. Use another authentication system like `http_basic` instead.

* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
The first configured provider is not used anymore and an exception is thrown instead.
Explicitly configure the provider to use on your firewalls.

Serializer
----------
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CHANGELOG
* deprecated command `acl:set` along with `SetAclCommand` class
* deprecated command `init:acl` along with `InitAclCommand` class
* Added support for the new Argon2i password encoder
* deprecated auto picking the first registered provider when no configured provider on a firewall and ambiguous

3.3.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
$defaultProvider = $providerIds[$normalizedName];
} else {
$defaultProvider = reset($providerIds);

if (count($providerIds) > 1) {
@trigger_error(sprintf('Firewall "%s" has no "provider" set but multiple providers exist. Using the first configured provider (%s) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.', $id, key($providerIds)), E_USER_DEPRECATED);
}
}

$config->replaceArgument(5, $defaultProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@
),

'firewalls' => array(
'simple' => array('pattern' => '/login', 'security' => false),
'simple' => array('provider' => 'default', 'pattern' => '/login', 'security' => false),
'secure' => array('stateless' => true,
'provider' => 'default',
'http_basic' => true,
'form_login' => true,
'anonymous' => true,
Expand All @@ -74,6 +75,7 @@
'logout_on_user_change' => true,
),
'host' => array(
'provider' => 'default',
'pattern' => '/test',
'host' => 'foo\\.example\\.org',
'methods' => array('GET', 'POST'),
Expand All @@ -82,6 +84,7 @@
'logout_on_user_change' => true,
),
'with_user_checker' => array(
'provider' => 'default',
'user_checker' => 'app.user_checker',
'anonymous' => true,
'http_basic' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
),

'firewalls' => array(
'simple' => array('pattern' => '/login', 'security' => false),
'simple' => array('provider' => 'default', 'pattern' => '/login', 'security' => false),
'secure' => array('stateless' => true,
'provider' => 'default',
'http_basic' => true,
'http_digest' => array('secret' => 'TheSecret'),
'form_login' => true,
Expand All @@ -75,13 +76,15 @@
'user_checker' => null,
),
'host' => array(
'provider' => 'default',
'pattern' => '/test',
'host' => 'foo\\.example\\.org',
'methods' => array('GET', 'POST'),
'anonymous' => true,
'http_basic' => true,
),
'with_user_checker' => array(
'provider' => 'default',
'user_checker' => 'app.user_checker',
'anonymous' => true,
'http_basic' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
),

'firewalls' => array(
'simple' => array('pattern' => '/login', 'security' => false),
'simple' => array('provider' => 'default', 'pattern' => '/login', 'security' => false),
'secure' => array('stateless' => true,
'provider' => 'default',
'http_basic' => true,
'http_digest' => array('secret' => 'TheSecret'),
'form_login' => true,
Expand All @@ -76,6 +77,7 @@
'logout_on_user_change' => true,
),
'host' => array(
'provider' => 'default',
'pattern' => '/test',
'host' => 'foo\\.example\\.org',
'methods' => array('GET', 'POST'),
Expand All @@ -84,6 +86,7 @@
'logout_on_user_change' => true,
),
'with_user_checker' => array(
'provider' => 'default',
'user_checker' => 'app.user_checker',
'anonymous' => true,
'http_basic' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<chain providers="service, basic" />
</provider>

<firewall name="simple" pattern="/login" security="false" />
<firewall name="simple" pattern="/login" security="false" provider="default" />

<firewall name="secure" stateless="true">
<firewall name="secure" stateless="true" provider="default">
<http-basic />
<form-login />
<anonymous />
Expand All @@ -57,12 +57,12 @@
<remember-me secret="TheSecret"/>
</firewall>

<firewall name="host" pattern="/test" host="foo\.example\.org" methods="GET,POST" logout-on-user-change="true">
<firewall name="host" pattern="/test" host="foo\.example\.org" methods="GET,POST" logout-on-user-change="true" provider="default">
<anonymous />
<http-basic />
</firewall>

<firewall name="with_user_checker" logout-on-user-change="true">
<firewall name="with_user_checker" logout-on-user-change="true" provider="default">
<anonymous />
<http-basic />
<user-checker>app.user_checker</user-checker>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<chain providers="service, basic" />
</provider>

<firewall name="simple" pattern="/login" security="false" />
<firewall name="simple" pattern="/login" security="false" provider="default" />

<firewall name="secure" stateless="true">
<firewall name="secure" stateless="true" provider="default">
<http-basic />
<http-digest secret="TheSecret" />
<form-login />
Expand All @@ -59,12 +59,12 @@
<remember-me secret="TheSecret"/>
</firewall>

<firewall name="host" pattern="/test" host="foo\.example\.org" methods="GET,POST">
<firewall name="host" pattern="/test" host="foo\.example\.org" methods="GET,POST" provider="default">
<anonymous />
<http-basic />
</firewall>

<firewall name="with_user_checker">
<firewall name="with_user_checker" provider="default">
<anonymous />
<http-basic />
<user-checker>app.user_checker</user-checker>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
<chain providers="service, basic" />
</provider>

<firewall name="simple" pattern="/login" security="false" />
<firewall name="simple" pattern="/login" security="false" provider="default" />

<firewall name="secure" stateless="true">
<firewall name="secure" stateless="true" provider="default">
<http-basic />
<http-digest secret="TheSecret" />
<form-login />
Expand All @@ -60,12 +60,12 @@
<remember-me secret="TheSecret"/>
</firewall>

<firewall name="host" pattern="/test" host="foo\.example\.org" methods="GET,POST" logout-on-user-change="true">
<firewall name="host" pattern="/test" host="foo\.example\.org" methods="GET,POST" logout-on-user-change="true" provider="default">
<anonymous />
<http-basic />
</firewall>

<firewall name="with_user_checker" logout-on-user-change="true">
<firewall name="with_user_checker" logout-on-user-change="true" provider="default">
<anonymous />
<http-basic />
<user-checker>app.user_checker</user-checker>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ security:
firewalls:
simple: { pattern: /login, security: false }
secure:
provider: default
stateless: true
http_basic: true
form_login: true
Expand All @@ -56,6 +57,7 @@ security:
user_checker: ~

host:
provider: default
pattern: /test
host: foo\.example\.org
methods: [GET,POST]
Expand All @@ -64,6 +66,7 @@ security:
logout_on_user_change: true

with_user_checker:
provider: default
anonymous: ~
http_basic: ~
user_checker: app.user_checker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ security:
firewalls:
simple: { pattern: /login, security: false }
secure:
provider: default
stateless: true
http_basic: true
http_digest:
Expand All @@ -59,13 +60,15 @@ security:
user_checker: ~

host:
provider: default
pattern: /test
host: foo\.example\.org
methods: [GET,POST]
anonymous: true
http_basic: true

with_user_checker:
provider: default
anonymous: ~
http_basic: ~
user_checker: app.user_checker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ security:
firewalls:
simple: { pattern: /login, security: false }
secure:
provider: default
stateless: true
http_basic: true
http_digest:
Expand All @@ -59,6 +60,7 @@ security:
user_checker: ~

host:
provider: default
pattern: /test
host: foo\.example\.org
methods: [GET,POST]
Expand All @@ -67,6 +69,7 @@ security:
logout_on_user_change: true

with_user_checker:
provider: default
anonymous: ~
http_basic: ~
user_checker: app.user_checker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,31 @@ public function testDeprecationForUserLogout()
$container->compile();
}

/**
* @group legacy
* @expectedDeprecation Firewall "default" has no "provider" set but multiple providers exist. Using the first configured provider (first) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.
*/
public function testDeprecationForAmbiguousProvider()
{
$container = $this->getRawContainer();

$container->loadFromExtension('security', array(
'providers' => array(
'first' => array('id' => 'foo'),
'second' => array('id' => 'bar'),
),

'firewalls' => array(
'default' => array(
'http_basic' => null,
'logout_on_user_change' => true,
),
),
));

$container->compile();
}

protected function getRawContainer()
{
$container = new ContainerBuilder();
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.