public interface Authentication extends Principal, Serializable {
Collection<? extends GrantedAuthority> getAuthorities();
Object getCredentials();
Object getDetails();
Object getPrincipal();
boolean isAuthenticated();
void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException;
}
구성요소
authorities: AuthenticationProvider에 의해 부여된 사용자 접근권한 목록
- 일반적으로
GrantedAuthority의 구현체는 SimpleGrantedAuthority
Principal: 사용자를 식별하는 고유 정보
- 일반적으로 username 또는
UserDetails의 구현체 자체가 Principal이 되며, 필요시 커스텀 객체를 생성하여 자유롭게 필드 구성 가능
Credencials: 사용자 인증에 필요한 Password를 의미하며, 인증이 완료된 후 ProviderManager가 해당 Credentials를 삭제함. 일반적인 방식에서는 이 상태로 Security Context에 저장되며, JWT 토큰 방식에서는 토큰이 발급된 후 Authentication 객체 자체가 삭제됨