1
0
mirror of synced 2026-08-05 09:47:05 +00:00

Polish Pbkdf2PasswordEncoder

Fixes gh-2158
Fixes gh-51
This commit is contained in:
Rob Winch
2016-04-12 17:01:01 -05:00
parent 0ab7126e64
commit 95a3e30d9f
4 changed files with 152 additions and 43 deletions
+14
View File
@@ -381,6 +381,7 @@ You can find the highlights below:
* <<csrf-cookie,CookieCsrfTokenRepository>> provides simple AngularJS & CSRF integration
* Added `ForwardAuthenticationFailureHandler` & `ForwardAuthenticationSuccessHandler`
* SCrypt support with `SCryptPasswordEncoder`
* PBKDF2 support with <<spring-security-crypto-passwordencoders,Pbkdf2PasswordEncoder>>
* Meta Annotation Support
** <<test-method-meta-annotations,Test Meta Annotations>>
** <<method-security-meta-annotations,Method Security Meta Annotations>>
@@ -6401,6 +6402,19 @@ String result = encoder.encode("myPassword");
assertTrue(encoder.matches("myPassword", result));
----
The `Pbkdf2PasswordEncoder` implementation uses PBKDF2 algorithm to hash the passwords.
In order to defeat password cracking PBKDF2 is a deliberately slow algorithm and should be tuned to take about .5 seconds to verify a password on your system.
[source,java]
----
// Create an encoder with all the defaults
Pbkdf2PasswordEncoder encoder = new Pbkdf2PasswordEncoder();
String result = encoder.encode("myPassword");
assertTrue(encoder.matches("myPassword", result));
----
[[concurrency]]
== Concurrency Support