bug #19667 [SecurityBundle] Add missing deprecation notice for form_login.intention (ro0NL)

This PR was squashed before being merged into the 2.8 branch (closes #19667).

Discussion
----------

[SecurityBundle] Add missing deprecation notice for form_login.intention

| Q             | A
| ------------- | ---
| Branch?       |  2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #19664, #19661, #19652
| License       | MIT
| Doc PR        | -
By the grace of @chalasr

ping @fabpot

Commits
-------

2a7bbd1 [SecurityBundle] Add missing deprecation notice for form_login.intention
This commit is contained in:
Fabien Potencier 2016-08-19 08:06:18 -07:00
commit fad374e62a

View File

@ -52,6 +52,10 @@ class FormLoginFactory extends AbstractFactory
->ifTrue(function ($v) { return isset($v['csrf_provider']) && isset($v['csrf_token_generator']); })
->thenInvalid("You should define a value for only one of 'csrf_provider' and 'csrf_token_generator' on a security firewall. Use 'csrf_token_generator' as this replaces 'csrf_provider'.")
->end()
->beforeNormalization()
->ifTrue(function ($v) { return isset($v['intention']) && isset($v['csrf_token_id']); })
->thenInvalid("You should define a value for only one of 'intention' and 'csrf_token_id' on a security firewall. Use 'csrf_token_id' as this replaces 'intention'.")
->end()
->beforeNormalization()
->ifTrue(function ($v) { return isset($v['csrf_provider']); })
->then(function ($v) {
@ -62,7 +66,18 @@ class FormLoginFactory extends AbstractFactory
return $v;
})
->end()
->end()
->beforeNormalization()
->ifTrue(function ($v) { return isset($v['intention']); })
->then(function ($v) {
@trigger_error("Setting the 'intention' configuration key on a security firewall is deprecated since version 2.8 and will be removed in 3.0. Use the 'csrf_token_id' key instead.", E_USER_DEPRECATED);
$v['csrf_token_id'] = $v['intention'];
unset($v['intention']);
return $v;
})
->end()
->children()
->scalarNode('csrf_token_generator')->cannotBeEmpty()->end()
->end()