1. 인증설정 (WebSecurityConfig.java)

WebSecurityConfig > http.formLogin() > UsernamePasswordAuthenticationFilter > SecurityFilterChain > 요청별 인증수행
 


2. 인증정보 받아오기 & 인증객체에 넣기 (UserDetailsServiceImpl.java)

UsernamePasswordAuthenticationFilter > UserDetailsService 구현 > loadUserByUsername() > User > UserDetails > Authentication (createSuccessAuthentication()에서 만들어짐)

 

3. 인증정보 구현체 (UserDetailsImpl.java)

UserDetails 구현체 > UserDetailsImpl
 

 

4. 인증객체(Authentication)에서 UserDetails 값 받아오기 (@AuthenticationPrincipal)

Authentication > getPrincipal() > UserDetails > user

'TIL > WEEK6' 카테고리의 다른 글

양방향 매핑 규칙  (0) 2023.06.22

 

 

어느 쪽을 연관 관계 주인으로 정해야 할까?

외래키를 가지고 있는 쪽을 주인으로 정한다!

일반적으로 N:1일 때 N인 쪽에 외래키를 준다.

 

 

DB처럼 양쪽에서 모두 조회가 되도록 하기 위해서 양방향 매핑을 한다.

가급적 단방향으로 매핑하는 게 좋지만 양방향으로 매핑해야 한다면 일단 단방향으로 매핑해 놓고 다음에 양방향 매핑을 적용한다.

'TIL > WEEK6' 카테고리의 다른 글

Spring Security  (0) 2023.06.23

+ Recent posts