본문 바로가기
Back-End/Spring Security

Authentication Components (3) Authentication

by sharekim 2021. 3. 17.

The Authentication serves two main purposes within Spring Security:

스프링시큐리티 인증은 두 가지 목적을 가지고 있다.


1. An input to AuthenticationManager to provide the credentials a user has provided to authenticate. When used in this scenario, isAuthenticated() returns false.

AuthenticationManager에게 credentials 을 주기 위함.

 

2. Represents the currently authenticated user. The current Authentication can be obtained from the SecurityContext.

현재 유저 정보를 대신하기 위함.


인증은 principal, credentials, authorities 를 가지고 있다.


  • princial      :  유저를 확인해준다. username/password 인증에서 UserDetails 객체로 자주 사용된다.
  • credentials :  주로 비밀번호. 대부분 유저 인증 후 보안상 유출을 막기 위해 clear 된다.
  • authorities  :  GrantedAuthoritys 는 유저가 받을 수 있는 허락이다. roles와 scopes로 구성.

** 모든 자료의 출처는 Spring.io 입니다.

댓글