svlada / springboot-security-jwt

Token-based authentication using Spring Boot and JWT.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AjaxAuthenticationProvider&JwtAuthenticationProvider

SuperNoobTao opened this issue · comments

Hello:
I have a problem on AjaxAuthenticationProvider and JwtAuthenticationProvider.
I see the configuration of both two in the WebSecurityConfig.
It likes that:

    @Override
    protected void configure(AuthenticationManagerBuilder auth) {
        auth.authenticationProvider(ajaxAuthenticationProvider);
        auth.authenticationProvider(jwtAuthenticationProvider);
    }

And I know that when I input '/login' ,it will enter AjaxLoginProcessingFilter , when I input '/api/me' ,it will enter JwtTokenAuthenticationProcessingFilter .
The question is that :
There are two Provider(AjaxAuthenticationProvider and JwtAuthenticationProvide). When I enter AjaxLoginProcessingFilter it always choose ajaxAuthenticationProvider. When I enter JwtTokenAuthenticationProcessingFilter it always choose jwtAuthenticationProvider. Why? How it always choose the right Provider???

Oh,I think I found the answer. Is that depends on method 'supports' in the 'Provider'???