Java Spring安全许可证不适用于多个URL
我试图给许可证所有的多个网址,但我得到403。当我禁用csrf时,所有请求都在没有身份验证的情况下工作。请在下面找到我的安全配置Java Spring安全许可证不适用于多个URL,java,spring-boot,microservices,spring-security-oauth2,Java,Spring Boot,Microservices,Spring Security Oauth2,我试图给许可证所有的多个网址,但我得到403。当我禁用csrf时,所有请求都在没有身份验证的情况下工作。请在下面找到我的安全配置 @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception {
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()//.anyRequest().permitAll()
.antMatchers("/actuator/**","/v1/foo/link")
.permitAll()
.antMatchers("/**")
.authenticated()
.and()
.oauth2ResourceServer()
.jwt(withDefaults());
}
}
请纠正我哪里不见了。谢谢 我在提到的stackoverflow链接中找到了这个答案,它正在工作
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/v1/foo/link").antMatchers("/v1/refer/link");
}