- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
要在 Spring Boot 中提供自定义身份验证提供程序,我是否需要以下两项?它们有什么区别?
HttpSecurity.authenticationProvider(...)
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter{
@Autowired
private MyAuthenticationProvider myAuthenticationProvider;
@Autowired
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(myAuthenticationProvider);
}
// --------------- OR/AND ? ----------------
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authenticationProvider(myAuthenticationProvider)
// ...
}
}
最佳答案
您只需使用这两个选项之一。在内部,http.authenticationProvider 只是调用 AuthenticationManagerBuilder.authenticationProvider。
关于spring - AuthenticationManagerBuilder 和 HttpSecurity.authenticationProvider 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43070356/
我正在编写一个 Google Chrome 扩展程序,它需要我使用 Spring 设置的用户身份验证,目前我的代码中有几个示例用户名和密码,而我仍在开发中。此时,我已准备好添加真实的用户名和密码,但我
我正在使用 Spring Security 4.0.1 并希望使用多个身份验证提供程序使用基于 Java 的配置进行身份验证。如何指定提供商顺序? 我希望使用 AuthenticationManage
我正在使用 Spring Boot 2.0(利用 Spring Security 5.0)。我正在尝试向 WebSecurityConfigurerAdapter 子类中的 Authenticatio
谁能解释一下何时覆盖 configure(HttpSecurity)、configure(WebSecurity) 和 configure(AuthenticationManagerBuilder)?
要在 Spring Boot 中提供自定义身份验证提供程序,我是否需要以下两项?它们有什么区别? AuthenticationManagerBuilder HttpSecurity.authentic
我正在研究基于 Spring Security Java 的配置。 我已经创建了我自己的 MyAuthenticationProvider,我想在 ProviderManager 中注册它(Authe
我正在配置 Spring Security。为了验证和授权用户,我覆盖了 configure(AuthenticationManagerBuilder auth)的 WebSecurityConfig
我有一个 SpringBoot 2.0.1.RELEASE mvc 应用程序,因此在安全配置中我定义了此方法: @Autowired public void configureGlobal(Auth
所以我正在研究 Spring Security 的实现。我遇到了一段我无法理解的代码。因此,根据文档,当我们想要自定义 Spring 使用的 AuthenticationManager 时,需要重写以
我有一个 SpringBoot 2.0.1.RELEASE mvc 应用程序,因此在安全配置中我定义了此方法: @Autowired public void configureGlobal(Auth
我已经设置了样板 spring security 配置器: public class SecurityConfiguration extends WebSecurityConfigurerAdapte
配置 Spring Security 时: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecur
WebSecurityConfigurerAdapter 提供两个覆盖如下: protected void configure(AuthenticationManagerBuilder auth) 和
我正在 Spring Boot 应用程序中学习 Spring Security,我有一个非常简单的示例。我看到,如果我评论 configure(AuthenticationManagerBuilder
我是一名优秀的程序员,十分优秀!