스프링 시큐리티 Access Denied 페이지 설정 방법
XML에서 설정
http 태그에 access-denied-handler 등록 후 Bean으로 정의
<!-- security:begin -->
<http
...
<access-denied-handler ref="accessDeniedHandler" />
...
</http>
<!-- security:end -->
<beans:bean id="accessDeniedHandler" class="org.springframework.security.web.access.AccessDeniedHandlerImpl">
<beans:property name="errorPage" value="/WEB-INF/views/login/denied.jsp" /> //페이지 경로 설정
</beans:bean>
자바에서 설정
WebSecurityConfigurerAdapter을 구현한 클래스에 accessDeniedPage 설정을 하면 된다.
@Override
protected void configure(HttpSecurity http) throws Exception {
...
http
.exceptionHandling()
.accessDeniedPage("/WEB-INF/views/login/denined.jsp"); //페이지 경로
}
'프로그래밍 > 스프링[Spring]' 카테고리의 다른 글
[스프링] com.google.common.io.BaseEncoding 에러 해결 (0) | 2023.02.18 |
---|---|
[Spring] session 에 변수 저장하기 (0) | 2023.02.15 |
[스프링] 자바 redirect 시 파라미터 전달하기 (0) | 2023.02.13 |
[소셜 로그인] 네이버, 카카오, 구글 버튼 가이드 링크 (0) | 2023.02.03 |
이클립스(Eclipse) 허용 메모리(Heap size) 간단 설정 (2) | 2023.01.28 |