부트캠프 기록/Section4

[Spring Security] 권한 부여(Authorization, 인가) 처리 흐름

bbangduck 2022. 11. 22. 14:17

✅ 학습 목표

  • Spring Security의 권한 부여(Authorization, 인가) 흐름을 이해할 수 있다.
  • Spring Security에서 권한 부여와 관련된 컴포넌트의 역할을 이해할 수 있다.
 
 

 

AuthorizationFilter 

> Spring Security Filter Chain에서 URL을 통해 사용자의 액세스를 제한하는 권한 부여 Filter

> SecurityContextHolder로 부터 Authentication을 획득

> SecurityContextHolder로 부터 획득한Authentication과 HttpServletRequest를 AuthorizationManager 에게 전달

 

AuthorizationManager

> 권한 부여 처리를 총괄하는 매니저 인터페이스

 

RequestMatcherDelegatingAuthorizationManager

> AuthorizationManager 를 구현하는 구현체 중 하나

> RequestMatcher 평가식을 기반으로 해당 평가식에 매치되는 AuthorizationManager 에게 권한 부여 처리를 위임

> 내부에서 매치되는 AuthorizationManager 구현 클래스가 있다면 해당 AuthorizationManager 구현 클래스가 사용자의 권 한을 체크

>적절한 권한이 아니라면 (5)와 같이 AccessDeniedException이 throw,  ExceptionTranslationFilterAccessDeniedException을 처리

 

 

 

 

심화 학습

더보기