개발자의 오르막

An Authentication object was not found in the SecurityContext 본문

Trouble Shouting

An Authentication object was not found in the SecurityContext

계단 2020. 8. 26. 16:37

# Error Message

An Authentication object was not found in the SecurityContext

원래 잘 되던 부분이 Post Mapping 을 날리는 부분에서 이런 오류가 났다.

아예 컨트롤러 자체를 타지 않는 것을 보아 시큐러티 환경설정 문제인듯 싶다.

 

일단 해당 위치는 로그인을 하지 않은 사람이 글을 쓸 수 있는 위치이다.

파트너 회원이 되기 위해 로그인 창에서 모달로 입점문의 글을 쓰는 위치이다.

 

accessToken 이 없어서 그럴 수 있다고 생각하긴 하는데,,

 

기존에는

@Override
public void configure(WebSecurity web) throws Exception {
    web.ignoring().antMatchers("/api/v1/signup");
}

이 부분처럼 해당 url 을 ignore 시키는 형태인데, 어느 순간부터 위의 에러메시지가 뜨기 시작했다.

 

 

https://www.it-swarm.dev/ko/java/%ED%8A%B9%EC%A0%95-url%EC%97%90-%EB%8C%80%ED%95%9C-%EC%8A%A4%ED%94%84%EB%A7%81-%EB%B3%B4%EC%95%88%EC%9D%84-%EB%B9%84%ED%99%9C%EC%84%B1%ED%99%94%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95/1053558761/

 

java — 특정 URL에 대한 스프링 보안을 비활성화하는 방법

이것은 귀하의 질문에 대한 정답이 아닐 수도 있지만 csrf 보호를 비활성화하는 방법을 찾고 있다면 다음을 수행하십시오. @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Over

www.it-swarm.dev

 

 

Comments