• springsecurity UserDetailsService的loadUserByUsername无法获取参数 坑位填补


    这个问题很撒皮他那个官方的方法可能写的有问题,第一axios 是 没有办法进行post方法访问的

    他获取不到你发回去的参数问题出现在headers的content-type应该,但是我把content-type的3中类型试过了有那个application/json与application/www-什么什么的-un*** 的 还有 text/p什么的,你用axios他就是不行我还以为我错哪里了,然后我试了好久先要满足以下条件

    ,你首先要判断在你的springsecurityconfig 类中  “没有进行”

    protected void configure(HttpSecurity http) 

    这个对页面授权的配置方法时,其他配置都有了

    private UserDetailsService userDetailsService;
    
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        //认证配置的重写
       auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
    }
    
    //使用springsecurity必须有密码加密器
    @Bean
    PasswordEncoder passwordEncoder(){
        return new BCryptPasswordEncoder();
    }

    这几个方法和UserDetailsService 的

    public UserDetails loadUserByUsername(String username)

    这个方法没有配置错误啊 就是你能在他那个默认的login界面能够进行密码的验证成功 就证明你没问题了然后你不要用axios发post就是不行接受不到,你必须要用最原始的表单 input type=submit来提交啊,然后我就好了,你可以将这个input隐藏  或者不让他显示但是你 vue依然可以用js获取dom来提交他又不是让你创建dom,所以我认为这个是不错的,

    总之就是你必须要用最原始的表单 input type=submit来提交啊 

  • 相关阅读:
    JWT开发详解
    shell编程
    Centos下部署CodiMD
    驱动day4
    Android ArrayMap源码解析
    SpringBoot跨域设置(CORS)
    【UV打印机】理光喷头组合说明(24H)
    极速系列04—python批量获取word中的表格
    [C/C++]数据结构----顺序表的实现(增删查改)
    常见C++开源库-几何算法库-Boost.Geometry-Clipper2-布尔运算库-支持开放式多段线-基础几何对象-详解教程
  • 原文地址:https://blog.csdn.net/weixin_46564011/article/details/125617452