mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-13 05:43:29 +00:00
PlaintextPasswordEncoder ignores null encoded passwords
Fixes gh-7023
This commit is contained in:
parent
4a7bdc1d65
commit
b2d4fec361
@ -51,6 +51,9 @@ public class PlaintextPasswordEncoder extends BasePasswordEncoder {
|
||||
}
|
||||
|
||||
public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
|
||||
if (encPass == null) {
|
||||
return false;
|
||||
}
|
||||
String pass1 = encPass + "";
|
||||
|
||||
// Strict delimiters is false because pass2 never persisted anywhere
|
||||
|
@ -70,4 +70,10 @@ public class PlaintextPasswordEncoderTests {
|
||||
assertThat(demerged[0]).isEqualTo("password");
|
||||
assertThat(demerged[1]).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNull() {
|
||||
PlaintextPasswordEncoder encoder = new PlaintextPasswordEncoder();
|
||||
assertThat(encoder.isPasswordValid(null, "null", null)).isFalse();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user