0
내 프로젝트에 2 개의 API가 있습니다. 첫 번째 인증에는 인증이 필요하고 두 번째 인증에는 인증이 필요하지 않습니다. 첫 번째 API /auth/uploadFile
스프링 부트의 웹 API 중 하나에서 인증 필터 제거
에 대한 토큰 기반 인증 필터를 추가하는
나는 여기 가 WebSecurityConfigurerAdapter을 확장 의 SecurityConfig 클래스의 코드가 성공적으로 할 수 있었다.@Override
protected void configure(HttpSecurity http) throws Exception {
http.addFilterBefore(tokenAuthenticationFilter, BasicAuthenticationFilter.class).authorizeRequests()
.antMatchers("/auth/uploadFile/").permitAll().anyRequest()
.authenticated().and().csrf().disable();
}
나는는 antMatchers() 내 두 번째 API /noauth/uploadFile
을 추가하지 않은 하지만 난 그것에 POST 호출을 할 때 여전히 사용자 정의 tokenAuthenticationFilter 들어갑니다. 내 필터가 두 번째 API에 적용해서는 안 즉 내 두 번째 API /noauth/uploadFile
에 전화를 걸 때
는 어떻게 사용자 정의 필터 tokenAuthenticationFilter를 입력하지 않도록 할 수 있습니까?