>2.3.11]中的某些url]

svujldwt  于 2021-09-30  发布在  Java
关注(0)|答案(0)|浏览(187)

我正在从2.1.4->2.3.11更新现有的springboot项目
扩展WebSecurityConfigureAdapter的类的现有代码如下

@Override
public void configure(WebSecurity web) {
    web.ignoring().antMatchers("/", "/csrf", "/v2/api-docs", "/configuration/ui", "/swagger-resources/**",
            "/configuration/**", "/swagger-ui.html", "/webjars/**", "/api/sample/**","/api/user/**","/api/departments/");
}

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().authenticated().and().cors().disable()
            .httpBasic().authenticationEntryPoint(authenticationEntryPoint()).and()
            .exceptionHandling().and().csrf().disable()
            .addFilterBefore(new GenericFilter(), ChannelProcessingFilter.class)
            .addFilterBefore(new SomeTokenFilter(tokensService), UsernamePasswordAuthenticationFilter.class);
}

这是一个在更新之前正在运行的现有代码。更新后,我无法忽略一些api,如swagger-ui.html,它是在忽略antmatchers规则中定义的。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题