spring-boot-react-oauth2-social-login-demo icon indicating copy to clipboard operation
spring-boot-react-oauth2-social-login-demo copied to clipboard

TokenAuthenticationFilter not injected correctly

Open KamBha opened this issue 5 months ago • 0 comments

I am not sure what TokenAuthenticationFilter is for, but something I noticed in WebSecurityConfiguration is you do the following:-

    @Bean
    public TokenAuthenticationFilter tokenAuthenticationFilter() {
        return new TokenAuthenticationFilter();
    }

This seems odd to me as this class has autowired elements attached to it that are not actually autowired in.

Looking at the code, the only reason why this is not causing failures is because there is no JWT token being passed in:-

            String jwt = getJwtFromRequest(request);

            if (StringUtils.hasText(jwt) && tokenProvider.validateToken(jwt))

Is this in fact dead code?

Looking at the front end code, I do not see any actual bearertoken being passed down, so I suspect that this is dead code.

KamBha avatar May 19 '25 21:05 KamBha