Skip to content

Commit

Permalink
PlaintextPasswordEncoder ignores null encoded passwords
Browse files Browse the repository at this point in the history
Fixes gh-7023
  • Loading branch information
rwinch committed Jun 19, 2019
1 parent 4a7bdc1 commit b2d4fec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public boolean isIgnorePasswordCase() {
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,10 @@ public void testMergeDemerge() {
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();
}
}

0 comments on commit b2d4fec

Please sign in to comment.