Skip to Content
Suffering builds character
아카이브18.spring Security스프링 시큐리티5.부록인증 APIs4.인증 관리자

4.인증 관리자

1.AuthenticationManager

AuthenticationManager 인터페이스는 스프링 시큐리티의 필터를 통해 인증 요청에 대한 처리 수행을 전반적으로 관리하는 객체
→ 인증 (관리) 매니저

AuthenticationManager.java
public interface AuthenticationManager { // Attempts to authenticate the passed object, returning a fully populated `Authentication` object (including granted authorities) if successful. Authentication authenticate(Authentication authentication) throws AuthenticationException; }

authenticate()의 인수로 전달받은 authentication 객체를 통해 인증 처리를 수행하고, 인증의 성공/실패 여부가 적용된 Authentication 객체를 반환함

반환된 Authentication 객체는 SecurityContextHolder에 보관됨

해당 인터페이스에 주로 사용되는 일반적인 구현체는 ProviderManager 클래스

2.ProviderManager

AuthenticationManager 인터페이스를 구현한 구현체

ProviderManager는 여러 개의 AuthenticationProvider 인스턴스를 List의 형태로 위임함

AuthenticationProvider는 인증이 성공적이어야 함을 표시하거나 실패, 또는 결정할 수 없음을 표시하고 다운스트림 AuthenticationProvider가 결정하도록 허용할 수 있는 기회를 가짐

인증을 수행할 수 있는 AuthenticationProvider 인스턴스가 존재하지 않을 경우, 인증은 실패하고,

적절한 인증 처리를 수행할 수 있는 ProviderManager가 설정되지 않았다는 ProviderNotFoundException 예외가 발생함

Last updated on