403 Forbidden에 대한 사용자 정의 메시지 정의가 가능합니다.

1. 로그인에 실패하는 경우의 메시지 정의

HttpSecurity에 AccessDeniedHandler를 구현 한다.

스프링부트의 경우 .exceptionHandling().accessDeniedHandler() 에 새롭게 정의한 내용을 활용한다.

2. 로그인 후 접근해야 하는 리소스에 접근할 때 메지시 정의

HttpSecurity에 AuthenticationEntryPoint 구현 한다.

스프링부트의 경우

.exceptionHandling().authenticationEntryPoint()에 새롭게 정의한 내용을 활용한다.

Leave a Reply

Your email address will not be published. Required fields are marked *