Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring安全性从自定义筛选器中排除端点_Spring_Spring Security_Spring Boot_Spring Java Config - Fatal编程技术网

Spring安全性从自定义筛选器中排除端点

Spring安全性从自定义筛选器中排除端点,spring,spring-security,spring-boot,spring-java-config,Spring,Spring Security,Spring Boot,Spring Java Config,具有具有以下功能的spring安全配置: http.antMatcher("/**/v1/public/company/employees/**") .authorizeRequests() .antMatchers(HttpMethod.OPTIONS, "/**/v1/public/company/employees/A").permitAll() .antMatchers(HttpMethod.

具有具有以下功能的spring安全配置:

http.antMatcher("/**/v1/public/company/employees/**")
                .authorizeRequests()
                .antMatchers(HttpMethod.OPTIONS, "/**/v1/public/company/employees/A").permitAll()
                .antMatchers(HttpMethod.POST, "/**/v1/public/company/employees/B").permitAll()
                .antMatchers("/**/v1/public/company/employees/**")
                .authenticated()
                .and()
                .csrf()
                .disable()
                .addFilterBefore(customFilter, AbstractPreAuthenticatedProcessingFilter.class);
如何从
customFilter
中排除公共端点(AB

更新

使用:

@Override
    public void configure(WebSecurity web) throws Exception {
        web
                .ignoring()
                .antMatchers(HttpMethod.OPTIONS, "/**/v1/public/company/employees/A")
                .antMatchers(HttpMethod.POST, "/**/v1/public/company/employees/B")
        }

似乎足够了,但我仍然不知道这是否是推荐的方法

所以基本上有三个端点-对吗?其中两个是公开的,另一个是需要身份验证的?我使用
/**
作为需要身份验证的端点,因此有很多端点。端点的数量很重要吗?因为我正在寻找通用的方法。一个解决方案可能是为端点A和B创建单独的http安全配置。这意味着您将得到两个额外的安全配置。我认为您可以遵循此指南