我正在尝试重新定义密码验证器和java中用于播放2的securesocial插件的密码hasher,因为我的身份验证过程无法正常工作..(实际上一切似乎都是正确的我无法管理我自己在我的数据库中使用哈希密码存储)
我已经将passwordValidator作为文档说明(http://securesocial.ws/guide/password-plugins.html)
public class BCryptPasswordHasher扩展了BasePasswordHasher {
public PasswordInfo doHash(String plainPassword){
PasswordInfo pI = new PasswordInfo();
pI.password = BCrypt.hashpw(plainPassword, BCrypt.gensalt());
return pI;
}
public boolean doMatch(PasswordInfo passwordInfo, String suppliedPassword){
return BCrypt.checkpw(suppliedPassword, passwordInfo.password);
}
}
我收到此错误:
tools.BCryptPasswordHasher不是抽象的,并且不会覆盖securesocial.core.java.BasePasswordHasher中的抽象方法doMatch(securesocial.core.java.PasswordInfo,java.lang.String)
你知道我怎么能做到这一点吗?
提前感谢您的帮助
PS:BasePasswordHasher
公共抽象类BasePasswordHasher实现PasswordHasher { 受保护的应用程序应用程序;
public BasePasswordHasher(Application application) {
this.application = application;
}
@Override
public securesocial.core.PasswordInfo hash(String plainPassword) {
return doHash(plainPassword).toScala();
}
@Override
public boolean matches(securesocial.core.PasswordInfo passwordInfo, String suppliedPassword) {
return doMatch(PasswordInfo.fromScala(passwordInfo), suppliedPassword);
}
/**
* Hashes a password
*
* @param plainPassword the password to hash
* @return a PasswordInfo containting the hashed password and optional salt
*/
abstract PasswordInfo doHash(String plainPassword);
/**
* Checks whether a supplied password matches the hashed one
*
* @param passwordInfo the password retrieved from the backing store (by means of UserService)
* @param suppliedPassword the password supplied by the user trying to log in
* @return true if the password matches, false otherwise.
*/
abstract boolean doMatch(PasswordInfo passwordInfo, String suppliedPassword);
}