All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lontime.extpac4j.impl.BCryptPasswordEncoder Maven / Gradle / Ivy

The newest version!
package com.github.lontime.extpac4j.impl;

import cn.hutool.crypto.digest.DigestUtil;
import org.pac4j.core.credentials.password.PasswordEncoder;

/**
 * BCryptPasswordEncoder.
 * @author lontime
 * @since  1.0
 */
public class BCryptPasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(String password) {
        return DigestUtil.bcrypt(password);
    }

    @Override
    public boolean matches(String plainPassword, String encodedPassword) {
        return DigestUtil.bcryptCheck(plainPassword, encodedPassword);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy