类 SafeBcryptPasswordEncoder
java.lang.Object
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
com.alibaba.nacos.plugin.auth.impl.SafeBcryptPasswordEncoder
- 所有已实现的接口:
org.springframework.security.crypto.password.PasswordEncoder
public class SafeBcryptPasswordEncoder
extends org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
BCrypt encoder that fixes the password length vulnerability.
Problem solved: When password length exceeds 72 characters, the original BCryptPasswordEncoder
only matches the first 72 characters, which could lead to different passwords being
validated as matching (e.g., passwords "A".repeat(73) and "A".repeat(80)
would be considered identical).
Fix logic: Adds length validation in matches(CharSequence, String),
returning false directly if the password length exceeds 72.
Recommendation: It is advised to add password length validation during user registration/password modification to prevent login failures caused by historical data issues.
- 作者:
- linwumignshi
- 另请参阅:
-
嵌套类概要
从类继承的嵌套类/接口 org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder.BCryptVersion -
构造器概要
构造器 -
方法概要
从类继承的方法 org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
encode, upgradeEncoding
-
构造器详细资料
-
SafeBcryptPasswordEncoder
public SafeBcryptPasswordEncoder()
-
-
方法详细资料
-
matches
- 指定者:
matches在接口中org.springframework.security.crypto.password.PasswordEncoder- 覆盖:
matches在类中org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
-