Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb07b7e

Browse files
committed
[Form] remove deprecated CSRF options
1 parent 8334952 commit bb07b7e

File tree

3 files changed

+1
-56
lines changed

3 files changed

+1
-56
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -231,36 +231,6 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
231231
->arrayNode('logout')
232232
->treatTrueLike(array())
233233
->canBeUnset()
234-
->beforeNormalization()
235-
->ifTrue(function ($v) { return isset($v['csrf_provider']) && isset($v['csrf_token_generator']); })
236-
->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'.")
237-
->end()
238-
->beforeNormalization()
239-
->ifTrue(function ($v) { return isset($v['intention']) && isset($v['csrf_token_id']); })
240-
->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'.")
241-
->end()
242-
->beforeNormalization()
243-
->ifTrue(function ($v) { return isset($v['csrf_provider']); })
244-
->then(function ($v) {
245-
@trigger_error("Setting the 'csrf_provider' configuration key on a security firewall is deprecated since version 2.8 and will be removed in 3.0. Use the 'csrf_token_generator' configuration key instead.", E_USER_DEPRECATED);
246-
247-
$v['csrf_token_generator'] = $v['csrf_provider'];
248-
unset($v['csrf_provider']);
249-
250-
return $v;
251-
})
252-
->end()
253-
->beforeNormalization()
254-
->ifTrue(function ($v) { return isset($v['intention']); })
255-
->then(function ($v) {
256-
@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);
257-
258-
$v['csrf_token_id'] = $v['intention'];
259-
unset($v['intention']);
260-
261-
return $v;
262-
})
263-
->end()
264234
->children()
265235
->scalarNode('csrf_parameter')->defaultValue('_csrf_token')->end()
266236
->scalarNode('csrf_token_generator')->cannotBeEmpty()->end()

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginFactory.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,6 @@ public function addConfiguration(NodeDefinition $node)
4848
parent::addConfiguration($node);
4949

5050
$node
51-
->beforeNormalization()
52-
->ifTrue(function ($v) { return isset($v['csrf_provider']) && isset($v['csrf_token_generator']); })
53-
->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'.")
54-
->end()
55-
->beforeNormalization()
56-
->ifTrue(function ($v) { return isset($v['csrf_provider']); })
57-
->then(function ($v) {
58-
@trigger_error("Setting the 'csrf_provider' configuration key on a security firewall is deprecated since version 2.8 and will be removed in 3.0. Use the 'csrf_token_generator' configuration key instead.", E_USER_DEPRECATED);
59-
60-
$v['csrf_token_generator'] = $v['csrf_provider'];
61-
unset($v['csrf_provider']);
62-
63-
return $v;
64-
})
65-
->end()
6651
->children()
6752
->scalarNode('csrf_token_generator')->cannotBeEmpty()->end()
6853
->end()

src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,12 @@ public function finishView(FormView $view, FormInterface $form, array $options)
111111
*/
112112
public function configureOptions(OptionsResolver $resolver)
113113
{
114-
// BC clause for the "intention" option
115-
$csrfTokenId = function (Options $options) {
116-
if (null !== $options['intention']) {
117-
@trigger_error('The form option "intention" is deprecated since version 2.8 and will be removed in 3.0. Use "csrf_token_id" instead.', E_USER_DEPRECATED);
118-
}
119-
120-
return $options['intention'];
121-
};
122-
123114
$resolver->setDefaults(array(
124115
'csrf_protection' => $this->defaultEnabled,
125116
'csrf_field_name' => $this->defaultFieldName,
126117
'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.',
127118
'csrf_token_manager' => $this->defaultTokenManager,
128-
'csrf_token_id' => $csrfTokenId,
129-
'intention' => null, // deprecated
119+
'csrf_token_id' => null,
130120
));
131121
}
132122

0 commit comments

Comments
 (0)