Spring boot 希望在spring boot security中仅为指定的url模式(管理服务url)而不是为所有url添加JWT筛选器吗

Spring boot 希望在spring boot security中仅为指定的url模式(管理服务url)而不是为所有url添加JWT筛选器吗,spring-boot,jwt,Spring Boot,Jwt,我们所有的端点URL都以“/api/**”开头,但我们只想对下面的URL使用jwtFilterRequest,所有其他URL都应该提供permitall GET/api/users POST/api/users GET/api/users/{userId} httpSecurity.cors().and().csrf().disable().authorizeRequests().antMatchers("/api/**").permitAll() .and().authorizeRequest

我们所有的端点URL都以“/api/**”开头,但我们只想对下面的URL使用jwtFilterRequest,所有其他URL都应该提供permitall

GET/api/users

POST/api/users

GET/api/users/{userId}

httpSecurity.cors().and().csrf().disable().authorizeRequests().antMatchers("/api/**").permitAll()
.and().authorizeRequests().anyRequest().authenticated()
.and().exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint)
.and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
        httpSecurity.addFilterBefore(jwtRequestFilter, BasicAuthenticationFilter.class);
能帮忙吗


提前感谢,

您应该为这些URL创建单独的配置,其中您只能有一个筛选器,即JWTAuthenticationFilter请查看此链接:已编辑我的请求,请提供帮助?