File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/Symfony/Component/Security/Core Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -144,10 +144,10 @@ private function getEncoderConfigFromAlgorithm(array $config): array
144
144
return [
145
145
'class ' => Pbkdf2PasswordEncoder::class,
146
146
'arguments ' => [
147
- $ config ['hash_algorithm ' ],
148
- $ config ['encode_as_base64 ' ],
149
- $ config ['iterations ' ],
150
- $ config ['key_length ' ],
147
+ $ config ['hash_algorithm ' ] ?? ' sha512 ' ,
148
+ $ config ['encode_as_base64 ' ] ?? true ,
149
+ $ config ['iterations ' ] ?? 1000 ,
150
+ $ config ['key_length ' ] ?? 40 ,
151
151
],
152
152
];
153
153
@@ -205,8 +205,8 @@ private function getEncoderConfigFromAlgorithm(array $config): array
205
205
'class ' => MessageDigestPasswordEncoder::class,
206
206
'arguments ' => [
207
207
$ config ['algorithm ' ],
208
- $ config ['encode_as_base64 ' ],
209
- $ config ['iterations ' ],
208
+ $ config ['encode_as_base64 ' ] ?? true ,
209
+ $ config ['iterations ' ] ?? 5000 ,
210
210
],
211
211
];
212
212
}
Original file line number Diff line number Diff line change @@ -162,6 +162,11 @@ public function testDefaultMigratingEncoders()
162
162
(new EncoderFactory ([SomeUser::class => ['class ' => NativePasswordEncoder::class, 'arguments ' => []]]))->getEncoder (SomeUser::class)
163
163
);
164
164
165
+ $ this ->assertInstanceOf (
166
+ MigratingPasswordEncoder::class,
167
+ (new EncoderFactory ([SomeUser::class => ['algorithm ' => 'bcrypt ' , 'cost ' => 11 ]]))->getEncoder (SomeUser::class)
168
+ );
169
+
165
170
if (!SodiumPasswordEncoder::isSupported ()) {
166
171
return ;
167
172
}
You can’t perform that action at this time.
0 commit comments