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

com.soento.security.service.DefaultPasswordService Maven / Gradle / Ivy

The newest version!
package com.soento.security.service;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * @author soento
 */
@Component
public class DefaultPasswordService implements PasswordEncoder {
    private BCryptPasswordEncoder bCryptPasswordEncoder;

    public DefaultPasswordService() {
        bCryptPasswordEncoder = new BCryptPasswordEncoder();
    }

    @Override
    public String encode(CharSequence rawPassword) {
        return bCryptPasswordEncoder.encode(rawPassword);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return bCryptPasswordEncoder.matches(rawPassword, encodedPassword);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy