my study.

Study/Spring

[Spring Security] Spring Security 500 error page ( "status" : 999 )

fftl 2021. 1. 2. 11:02

spring security를 공부하면서 예제를 따라하고 있는데, 올바른 권한(USER)을 가진 계정으로 로그인을 시도했을때

 

login

 

error

위와 같은 json 메시지가 나타나는 페이지로 이동되는 오류가 발생했다.

 

권한에 맞지 않는 계정의 페이지로 이동하면 아래와 같이 403 에러가 나타남으로 권한을 잘 이해하고 있는 것 같았다. 

 

error

그래서 구글링해보니 stackoverflow.com/questions/61029340/spring-security-redirects-to-page-with-status-code-999/61029341

 

Spring security redirects to page with status code 999

After successful login spring redirects to /error page with the following content { "timestamp" : 1586002411175, "status" : 999, "error" : "None", "message" : "No message available" } I'm...

stackoverflow.com

페이지에서 해결을 할 수 있었다. 정확히는 설명을 이해 할 수는 없었지만 대략 이해해보자면 로그인을 성공하며 나타내야하게 될 페이지에 사용될 정적자원들에 대한 접근이 불가한 상태라는 뜻 같았다. 그래서 아래와 같이 web.ignoring()에 .antMatchers("/favicon.ico", "/resources/**", "/error"); 를 추가해 주었더니 정상적으로 페이지에 접속을 할 수 있었다.

 

update code
login success

 

springboot security 는 블로그의 예제를 이용하여 공부하고 있습니다. dkyou.tistory.com/18 

 

7. [springboot] Spring Security 간단 권한관리 예제 - UserDetailsService 방식

1. 서론 - 오늘은 userDetailsService를 이용하여 DB에서 정보를 가져와 인증하는 방식을 구현해보고자 합니다. - 이 글을 이해하면 로그인 기능을 구현할 수 있습니다. - 질문은 댓글로 언제든 환영합

dkyou.tistory.com