Spring Security에 관한 전반적인 내용

조갱·2022년 2월 26일
0

Spring Security

목록 보기
1/3

Spring Security와 Attribute Converter (이곳을 클릭하지 마세요. 아직 글 안썼습니다 ㅠㅠ) 이슈에 대한 글을 적다가, 글의 내용이 너무 방대해져 포스팅을 나누어서 하려고 한다.

이번 포스팅은 Spring Security 에 대한 전반적인 내용이다.

Spring Security도 하나의 Framework이기 때문에, 그 내용이 너무 방대해 공부하는 대로 내용을 조금씩 추가하려고 한다.

1. Spring Security 란?

Spring 공식 문서 (https://spring.io/projects/spring-security)에서는 Spring Security에 대해 아래와 같이 정의한다.

Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications.
Spring Security is a framework that focuses on providing both authentication and authorization to Java applications. Like all Spring projects, the real power of Spring Security is found in how easily it can be extended to meet custom requirements

한국어로 짧게 정리하자면, Spring Security자바 어플리케이션에서 인증과 인가를 제공하는, 강력하고 커스터마이징이 용이한 (사실상 Spring의 표준)프레임워크이다.

2. 인증(Authentication)과 인가(Authorization)

위에 설명을 읽다 보면, AuthenticationAuthorization 이라는 단어가 존재한다. 느낌적인 느낌으로만 보면 둘이 같은 단어같다. (토익 875의 한계) 포스팅을 쓰기 위해 공부하며 새롭게 알게 된 지식을 함께 공유한다.

인증 (Authentication) : 사용자가 본인이 맞는지 확인
인가 (Authorization) : 인증된 사용자가 자원에 접근이 가능한지 확인

굵은 글씨로도 강조 했지만, Authorization은 인증이 선행되어야 한다.

3. Principal 과 Credential

아마 Spring Security를 사용해본 사람들이라면 한번쯤 사용해봤을 것이다. getPrincipal()getCredential().

Principal (접근 주체) : 자원에 접근하려는 사용자
Credential (비밀번호) : 자원에 접근하려는 사용자의 비밀번호
를 의미하며, 실제로 Login쪽 코드를 디버깅하여 살펴보면 아래와 같이 나온다.
물론, 인증 (Authentication) 이후에는 authenticated가 true로 바뀌면서 credentials변수가 null로 바뀐다. (사진은 인증중인 과정.)

4. 인증 (Authentication)의 전반적인 과정

은 추가중인 내용입니다!

Reference :
Spring Security : https://spring.io/projects/spring-security
Spring Security : https://mangkyu.tistory.com/76

profile
A fast learner.

0개의 댓글