공부하는 블로그입니다!
궁금한 점은 댓글을 달아주세요!
spring boot - security사용 중 rest로 post보낼 때 계속 403이 뜨는 이유
Springboot Security이용 중 post를 날릴 때 계속 403 에러가 뜬다면
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception
{
http.csrf().disable();
http.authorizeRequests()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/**").permitAll();
}
}
WebSecurityConfigurerAdapter을 상속한 config파일의 configure(HttpSecurity http)메소드 안에 아래의 이 부분을 추가해 주면 된다.
http.csrf().disable();
Thank You For Reading