使用webflux启用ldapAuthoritiesPopulator

时间:2019-04-09 23:28:01

标签: spring security spring-webflux

我能够使用Spring Security从LDAP获得身份验证并从数据库中担任角色

@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
     auth
            .ldapAuthentication()
           .userSearchFilter("uid={0}")
            .ldapAuthoritiesPopulator(rolesPopulator)
            .contextSource(contextSource());

}

但是在启用Webflux的情况下进行相同的操作是一个挑战。

public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http, ReactiveAuthenticationManager reactiveAuthenticationManager, DataApiAuthrotiyPopulator dataApiAuthrotiyPopulator) {

    http
            .authorizeExchange()
            .anyExchange().authenticated()
            .and().authenticationManager(reactiveAuthenticationManager)
            .httpBasic();

    return http.build();
}

是否没有添加ldapAuthoritiesPopulator的规定?

0 个答案:

没有答案