Hi,
I am trying to implement Sha 256 password encryption algorithm. As stated in forums followed below steps.
- created a bean and implemented below methods.
- added bean definition in spring.xml
- added the property in app.properties
cuba.legacyPasswordEncryptionModule = bpd_Sha256EncryptionService - Below is the sample code written in custom bean.
**@Service(Sha256EncryptionService.NAME)
public class Sha256EncryptionServiceBean implements Sha256EncryptionService {
@Override
public HashDescriptor getHash(String content) {
return null;
}
@Override
public String getHashMethod() {
return "bcrypt";
}
@Override
public String getPlainHash(String content) {
return "$2a$10$vQx8b8B7jzZ0rQmtuK4YDOKp7nkmUCFjPx6DMT.voPtetNHFOsaOu";
}
@Override
public String getHash(String content, String salt) {
return "$2a$10$vQx8b8B7jzZ0rQmtuK4YDOKp7nkmUCFjPx6DMT.voPtetNHFOsaOu";
}
@Override
public String getPasswordHash(UUID userId, String password) {
return "$2a$10$vQx8b8B7jzZ0rQmtuK4YDOKp7nkmUCFjPx6DMT.voPtetNHFOsaOu";
}
@Override
public boolean checkPassword(User user, String rawPassword) {
return true;
}**
facing the below error during startup.
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ‘com.touchngo.raptor.service.Sha256EncryptionServiceBean’ to required type ‘com.haulmont.cuba.core.sys.encryption.EncryptionModule’ for property ‘legacyEncryptionModule’; nested exception is java.lang.IllegalStateException: Cannot convert value of type ‘com.touchngo.raptor.service.Sha256EncryptionServiceBean’ to required type ‘com.haulmont.cuba.core.sys.encryption.EncryptionModule’ for property ‘legacyEncryptionModule’: no matching editors or conversion strategy found
Please share the sample project