SpringSecurity越过数据库登录

/**
 * 用户认证规则
 *
 * @author Z0001
 * @since 2020-03-17
 */
@Component
public class CustomUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String param) throws AuthenticationException {
        // TODO:后期更换为数据库验证密码
        String pwd = new BCryptPasswordEncoder().encode("admin");

        return AuthUser.builder()
                .loginName(param)
                .password(pwd)
                .build();
    }
}

你可能感兴趣的:(个人笔记)