如何在Spring Boot中配置多重身份验证提供?

时间:2019-06-08 09:03:01

标签: spring spring-boot security ldap

在我的spring boot项目中,我想提供2个身份验证提供程序。
1.从数据库验证用户
2.从LDAP验证用户。

如何在Spring Boot中配置多个身份验证提供程序。

1 个答案:

答案 0 :(得分:0)

import { useIsDrawerOpen } from "@react-navigation/drawer";

let lastDrawerStateIsOpened = false;
const DrawerComponent = (props) => {
  const isOpened = useIsDrawerOpen();
  if (lastDrawerStateIsOpened != isOpened) {
    lastDrawerStateIsOpened = isOpened;
    if (isOpened) {
      // Do what needs to be done when drawer is opened.
    }
  }
};

public CustomAuthenticationProvider 实现了 AuthenticationProvider {

@Component

}

公共类 CustomSessionBasedWebSecurityConfig 扩展了 WebSecurityConfigurerAdapter {

      @Override
      Authentication authenticate(Authentication authentication)
        throws AuthenticationException {
           //TODO write your authentication logic
        }

//这里我们可以添加尽可能多的提供者。 } }