Skip to content

Commit d84e37a

Browse files
committed
feature #41960 [PasswordHasher][Security] Remove legacy password encoders (chalasr)
This PR was merged into the 6.0 branch. Discussion ---------- [PasswordHasher][Security] Remove legacy password encoders | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Time to clean :) Commits ------- fa37025 [Security][PasswordHasher] Remove legacy password encoders
2 parents 83de78c + fa37025 commit d84e37a

File tree

69 files changed

+17
-3792
lines changed

Some content is hidden

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

69 files changed

+17
-3792
lines changed

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ CHANGELOG
55
---
66

77
* The `security.authorization_checker` and `security.token_storage` services are now private
8+
* Remove `UserPasswordEncoderCommand` class and the corresponding `user:encode-password` command,
9+
use `UserPasswordHashCommand` and `user:hash-password` instead
10+
* Remove the `security.encoder_factory.generic` service, the `security.encoder_factory` and `Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface` aliases,
11+
use `security.password_hasher_factory` and `Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface` instead
12+
* Remove the `security.user_password_encoder.generic` service, the `security.password_encoder` and the `Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface` aliases,
13+
use `security.user_password_hasher`, `security.password_hasher` and `Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface` instead
814

915
5.3
1016
---

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

Lines changed: 0 additions & 216 deletions
This file was deleted.

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

Lines changed: 0 additions & 70 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy