Tag: 春季安全

Spring Security多个成功的认证提供商

我希望我的Web应用程序的用户通过LDAP和其他自定义身份validation进行身份validation。 这是一个用Kotlin编写的Spring Boot应用程序。 我已经配置AuthenticationManagerBuilder如下 @Autowired lateinit var authenticationProvider: CustomAuthenticationProvider override fun configure(auth: AuthenticationManagerBuilder) { auth .authenticationProvider(authenticationProvider) auth .ldapAuthentication() .userDnPatterns(“uid={0},ou=people”) .groupSearchBase(“ou=groups”) .contextSource() .url(“ldap://localhost:8389/dc=example,dc=com”) .and() .passwordCompare() .passwordEncoder(PlaintextPasswordEncoder()) .passwordAttribute(“userPassword”) } 我想连锁身份validation,以便如果CustomAuthenticationProvider成功身份validation(function身份validation不会抛出)身份validation继续使用LDAP身份validation提供程序。 如果CustomAuthenticationProvider成功进行身份validation,则写入LDAP身份validation(以及任何后续的身份validation提供程序)不会被评估。 只有在CustomAuthenticationProvider引发时才执行LDAP认证。 我已经阅读了许多文章(例如Spring Security中的多个身份validation提供者),详细描述了具有多个身份validation提供程序但具有OR行为而非AND行为的文章。 有什么建议么?