TIL

Architecture

A Review of Filters

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
	// do something before the rest of the application
    chain.doFilter(request, response); // invoke the rest of the application
    // do something after the rest of the application
}

DelegatingFitlerProxy

SecurityFilterChain

Security Filters

Handling Security Exception

ExceptionTranslationFilter는 애플리케이션에서 AccessDeniedException이나 AuthenticationException이 발생했을 때만 동작한다.

try {
	filterChain.doFilter(request, response);
} catch (AccessDeniedException | AuthenticationException ex) {
	if (!authenticated || ex instanceof AuthenticationException) {
		startAuthentication();
	} else {
		accessDenied();
	}
}

RequestCache