Security
// 커스텀한 유저 서비스 등록하는 방법. @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userService); }
3-Tier 아키텍쳐

- 가장 보편적이고 이해하기 쉬운 아키텍쳐이다.
- 프레젠테이션 레이어 - 사용자와의 접점 제공
- 애플리케이션 레이어 - 트랜잭션 처리를 위한 비즈니스 로직 제공
- 데이터 레이어 - 데이터를 저자, 조회 기능 제공
- 그 외의 장점들
- 프론트, 백엔드 역할 분리에 따른 업무 효율화
- 각 계층을 모듈화해서 다른 계층에 미치는 영향을 최소화하며 확장이 용이함



그래서 스프링은 Spring Session 을 지원한다.!
Spring Session의 핵심 - SessionRepository / SessionRepositoryFilter
- SessionRepository
- Session의 생성, 저장, 조회, 삭제 처리에 대한 책임을 가진다.
- 스토리지 종류에 따라 다양한 구현체를 제공해준다.
- MapSessionRepository - In-Memory Map기반이며 별도의 의존 라이브러리 필요없음
- RediIndexdSessionRepositroy - redis 기반이며 @EnableRedisHttpSession애노테이션으로 생성됨
- JdbcIndexedSessionRepository - jdbc 기반이며 @EnableJdbcHttpSession 애노테이션으로 생성된다.
- SessionRepositoryFilter
- 모든 HTTP요청에 대해 동작한다.
- HTTPServletReuqest, Response 인터페이스 구현을 SessionRepositoryRequestWrapper, ResponseWrapper 구현체로 교체한다.
- HttpServletRequest, Response 인터페이스의 세션 처리와 관련한 처리를 오버라이드 해야함.
- 세션 관련 생성 및 입출력은 SessionRepository 인터페이스를 통해 처리함
- HttpSession 인터페이스에 대해 Spring Session 구현체 HttpSessionWrapper 를 사용하도록함
- HttpSessionWrapper 구현체는 org.springframework.session.Session 인터페이스를 포함하고 있다.
- 스토리지 종류에 따라 구현체가 달라진다.
