Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

스프링 시큐리티의 구조 #16

Open
kmw10693 opened this issue Apr 12, 2022 · 0 comments
Open

스프링 시큐리티의 구조 #16

kmw10693 opened this issue Apr 12, 2022 · 0 comments

Comments

@kmw10693
Copy link

다운로드

1. Http Request 수신

  • 스프링 시큐리티는 필터로 동작한다.

  • 요청이 들어오면, 인증과 권한을 위한 필터(Authentication Filter)를 통하게 된다.

2. 유저 자격을 기반으로 인증 토큰(UsernamePasswordAuthenticationToken) 만들기

  • username과 password를 요청으로 유저 자격 기반으로 UsernamePasswordAuthenticationToken 생성한다.

3. Authentication Filter를 통해 인증 토큰을 AuthenticationManager에 위임

  • AutheticationManager는 인증을 처리하는 방법을 정의한 API이다.

  • 인증 토큰이 생성된 후, AuthenticationManager의 인증 메서드 호출

  • AuthenticationManager는 인터페이스로 정의 (실제 구현: ProviderManager에서 시행)

4. AuthenticationProvider의 목록으로 인증 시도

5. UserDetailsService의 요구

  • UserDetailsService는 username 기반의 userDetails 검색

  • AuthenticationProvider의 DaoAuthenticationProvider를 사용

  • UserDetailsService는 인터페이스이기 때문에 UserDetails를 가져오는 CustomUserDetailService 생성

6. UserDetail를 이용해서 User 객체에 대한 정보 검색

  • UserDetails는 인터페이스로, 우리가 직접 생성한 User 객체에서 정보를 가져올때 사용

7. User객체의 정보를 UserDetails가 UserDetailsService에 전달

8. 인증 객체 또는 AuthenticationException

9. 인증이 끝나면 -> AuthenticationManager는 완전한 인증 객체를 Authentication Filter에 반환한다.

10. SecurityContext에 인증 객체를 설정한다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant