Skip to content

Commit 3d344fe

Browse files
committed
[Security][PasswordHasher] Remove legacy password encoders
1 parent 16488a1 commit 3d344fe

File tree

68 files changed

+25
-3804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+25
-3804
lines changed

src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php

-216
This file was deleted.

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

-70
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,6 @@ public function getConfigTreeBuilder()
6666
return $v;
6767
})
6868
->end()
69-
->beforeNormalization()
70-
->ifTrue(function ($v) {
71-
if ($v['encoders'] ?? false) {
72-
trigger_deprecation('symfony/security-bundle', '5.3', 'The child node "encoders" at path "security" is deprecated, use "password_hashers" instead.');
73-
74-
return true;
75-
}
76-
77-
return $v['password_hashers'] ?? false;
78-
})
79-
->then(function ($v) {
80-
$v['password_hashers'] = array_merge($v['password_hashers'] ?? [], $v['encoders'] ?? []);
81-
$v['encoders'] = $v['password_hashers'];
82-
83-
return $v;
84-
})
85-
->end()
8669
->children()
8770
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
8871
->enumNode('session_fixation_strategy')
@@ -111,7 +94,6 @@ public function getConfigTreeBuilder()
11194
->end()
11295
;
11396

114-
$this->addEncodersSection($rootNode);
11597
$this->addPasswordHashersSection($rootNode);
11698
$this->addProvidersSection($rootNode);
11799
$this->addFirewallsSection($rootNode, $this->factories);
@@ -392,58 +374,6 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode)
392374
;
393375
}
394376

395-
private function addEncodersSection(ArrayNodeDefinition $rootNode)
396-
{
397-
$rootNode
398-
->fixXmlConfig('encoder')
399-
->children()
400-
->arrayNode('encoders')
401-
->example([
402-
'App\Entity\User1' => 'auto',
403-
'App\Entity\User2' => [
404-
'algorithm' => 'auto',
405-
'time_cost' => 8,
406-
'cost' => 13,
407-
],
408-
])
409-
->requiresAtLeastOneElement()
410-
->useAttributeAsKey('class')
411-
->prototype('array')
412-
->canBeUnset()
413-
->performNoDeepMerging()
414-
->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end()
415-
->children()
416-
->scalarNode('algorithm')
417-
->cannotBeEmpty()
418-
->validate()
419-
->ifTrue(function ($v) { return !\is_string($v); })
420-
->thenInvalid('You must provide a string value.')
421-
->end()
422-
->end()
423-
->arrayNode('migrate_from')
424-
->prototype('scalar')->end()
425-
->beforeNormalization()->castToArray()->end()
426-
->end()
427-
->scalarNode('hash_algorithm')->info('Name of hashing algorithm for PBKDF2 (i.e. sha256, sha512, etc..) See hash_algos() for a list of supported algorithms.')->defaultValue('sha512')->end()
428-
->scalarNode('key_length')->defaultValue(40)->end()
429-
->booleanNode('ignore_case')->defaultFalse()->end()
430-
->booleanNode('encode_as_base64')->defaultTrue()->end()
431-
->scalarNode('iterations')->defaultValue(5000)->end()
432-
->integerNode('cost')
433-
->min(4)
434-
->max(31)
435-
->defaultNull()
436-
->end()
437-
->scalarNode('memory_cost')->defaultNull()->end()
438-
->scalarNode('time_cost')->defaultNull()->end()
439-
->scalarNode('id')->end()
440-
->end()
441-
->end()
442-
->end()
443-
->end()
444-
;
445-
}
446-
447377
private function addPasswordHashersSection(ArrayNodeDefinition $rootNode)
448378
{
449379
$rootNode

0 commit comments

Comments
 (0)