Spring Security 推荐教程

下面两个都是基于SpringBoot+Spring Security 5.0的

一 Filter会调用AuthenticationManager来认证,AuthenticationManager 又会调用AuthenticationProvider来处理。我们如何注册自定义的AuthenticationProvider?

目前资料发现三种方式

  • 直接将AuthenticationProvider设置到对应的Filter中。参考:https://www.cnblogs.com/lori/p/10400564.html
  • 将AuthenticationProvider对象设置到AuthenticationManager中应该是所有Filter公用的。如:
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.authenticationProvider(customAuthenticationProvider);
}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容