title: JWT Token not generated after successful Authentication in Spring Boot
body: <p>I created two filters to run for every request JwtUsernameAndPasswordFilter and JwtTokenVerifier. I have used these two filters before and they HAVE worked. I think the main issue is with my Spring Security Config. When I debug these two filters only JwtTokenVerified is recognized and JwtUsernameAndPasswordFilter does not get called at all. When I make a request from PostMan with a application/json content type the server would give me an error:</p>
  <p><code>class path resource [templates/logIn.html] cannot be opened because it does not exist</code></p>
  <p>/logIn Controller</p>
  <pre><code>@RequestMapping(value=&quot;/logIn&quot;,method = {RequestMethod.POST,RequestMethod.GET})
      public void login(){
      }
  </code></pre>
  <p>Spring Security Config</p>
  <pre><code>@EnableGlobalMethodSecurity(prePostEnabled = true)
  @EnableWebSecurity
  @Configuration
  @Builder
  @AllArgsConstructor(onConstructor = @__(@Autowired))
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      private SecureUserDaoService secureUserDaoService;
      private JwtConfig jwtConfig;
      private SecretKey secretKey;
      private PasswordEncoder passwordEncoder;
  
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http
                  .csrf().disable()
  
                  .sessionManagement()
                  .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
  
                  .and()
  
                  .addFilter(new JwtUsernameAndPasswordFilter(authenticationManager(), jwtConfig, secretKey))
                  .addFilterAfter(new JwtTokenVerifier(secretKey, jwtConfig), JwtUsernameAndPasswordFilter.class)
  
                  .authorizeRequests()
  
                  .antMatchers(&quot;/accountPage&quot;, &quot;/accountSettings&quot;).authenticated()
                  .antMatchers(&quot;/&quot;, &quot;/signUp&quot;, &quot;/logIn&quot;).permitAll()
                  .anyRequest().authenticated()
                  .and()
  
                  .formLogin()
                  .failureUrl(&quot;/&quot;)
                  .successForwardUrl(&quot;/accountPage&quot;);
      }
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth.authenticationProvider(daoAuthenticationProvider());
      }
  
      @Bean
      public DaoAuthenticationProvider daoAuthenticationProvider(){
          DaoAuthenticationProvider provider =
                  new DaoAuthenticationProvider();
          provider.setPasswordEncoder(passwordEncoder);
          provider.setUserDetailsService(secureUserDaoService);
          return provider;
      }
  </code></pre>
  <p>github <a href="https://github.com/NikitaNova/BasicCrudApp/tree/master/src/main/java/com/crudapp" rel="nofollow noreferrer">repo</a></p>
  <p>UPDATE:</p>
  <p>By calling &quot;/login&quot; instead of &quot;/logIn&quot; in the client made it work, because apparently even when I add .loginPage(&quot;/logIn&quot;) AND .logInProcessingUrl(&quot;/logIn&quot;).It seems like spring still does not recognize my custom login controller when it goes through the filter chain. Feel free to comment below if you know of a better solution</p>