2
0
Эх сурвалжийг харах

Add BCrypt Test for Empty Raw Password

Issue: gh-5548
Rob Winch 6 жил өмнө
parent
commit
ae0f330f98

+ 8 - 0
crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoderTests.java

@@ -27,6 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat;
  */
 public class BCryptPasswordEncoderTests {
 
+	@Test
+	// gh-5548
+	public void emptyRawPasswordDoesNotMatchPassword() {
+		BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
+		String result = encoder.encode("password");
+		assertThat(encoder.matches("", result)).isFalse();
+	}
+
 	@Test
 	public void $2yMatches() {
 		// $2y is default version