小编pro*_*omy的帖子

Spring Security 多个 UserDetailsS​​ervice

我有 3 个不同的表,每个表都有用户信息。(可能相同的用户名但不同的密码)

此外,有 3 个不同的 URL 进行授权。是否可以在UserDetailsService一个配置中使用多个并在授权控制期间使用哪个表?

这是我的配置代码,但我无法控制在授权期间使用哪个表:

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Import(SecurityProblemSupport.class)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    private final AuthenticationManagerBuilder authenticationManagerBuilder;

    @Qualifier("userDetailsService")
    private final UserDetailsService userDetailsService;

    @Qualifier("customerDetailsService")
    private final UserDetailsService customerDetailsService;

    private final TokenProvider tokenProvider;

    private final CorsFilter corsFilter;

    private final SecurityProblemSupport problemSupport;

    public SecurityConfiguration(AuthenticationManagerBuilder authenticationManagerBuilder, UserDetailsService userDetailsService, UserDetailsService customerDetailsService, TokenProvider tokenProvider, CorsFilter corsFilter, SecurityProblemSupport problemSupport) {
        this.authenticationManagerBuilder = authenticationManagerBuilder;
        this.userDetailsService = userDetailsService;
        this.customerDetailsService = customerDetailsService;
        this.tokenProvider = tokenProvider;
        this.corsFilter = …
Run Code Online (Sandbox Code Playgroud)

spring spring-security jhipster

5
推荐指数
1
解决办法
4216
查看次数

标签 统计

jhipster ×1

spring ×1

spring-security ×1