2016-12-28 6 views
0

私はあなたに春のセキュリティについて質問したいと思います。 私はTestSecurityConfigurationと呼ばれるHttpSecurityを設定するためにこのクラスを持っています。例えば、私は2つのトークンプロバイダATokenProviderとBTokenProviderを持っています。だから私は1つのファイルクラスTestSecurityConfigurationで2トークンプロバイダを登録することができますか?Spring MVCの1 javaクラスの複数のトークンプロバイダ

class TestSecurityConfiguration extends WebSecurityConfigurerAdapter { 

    @Autowired 
    private ATokenProvider A; 

    @Autowired 
    private BTokenProvider B; 

    @Override 
    protected void configure(HttpSecurity http) throws Exception {....} 

    @Override 
    protected void configToken(AuthenticationManagerBuilder auth) throws Exception { 
    auth.authenticationProvider(A); 
    auth.authenticationProvider(B); 
    } 
} 

ありがとうございました。

答えて

0

はい、2つのプロバイダを登録できます。

しかし、あなたはsupports方法が異なるAuthenticationAuthenticationManagerがtrueの場合、最初に、プロバイダはAuthenticationを処理するsupports方法でプロバイダをテストしますサポートするために実装する必要があります。

関連する問題