package com.eactive.ext.kjb.spring;

//import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

public class KjbSafedbPasswordEncoder implements PasswordEncoder {
    private final BCryptPasswordEncoder bcryptEncoder = new BCryptPasswordEncoder();

    @Override
    public String encode(CharSequence rawPassword) {
        String bcryptHash = bcryptEncoder.encode(rawPassword);
        return bcryptHash;
//        KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance();
//        return safedb.encryptNotRnnoString(bcryptHash);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
//        KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance();
//        String bcryptHash = safedb.decryptNotRnno(encodedPassword);
//        return bcryptEncoder.matches(rawPassword, bcryptHash);
    	return true;
    }
}
