Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions keyword/chapter09/keyword.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
- 세션과 토큰의 차이는?

### 세션

비밀번호 등 클라이언트의 민감한 인증 정보를 브라우저가 아닌 서버 측에 저장하고 관리한다.

⇒민감정보는 서버에서 모두 관리한다.

- 세션 객체
- key : SESSION ID
- value : 세션 생성 시간, 마지막 접근 시간, 속성 등
- 인증 과정
- 유저가 로그인 → 서버 상에 저장
- 서버에서 브라우저에 쿠키에다가 Session ID 저장
- 브라우저는 해당 사이트에 대한 모든 Request에 Session ID를 쿠키에 담아 전송
- 서버는 클라이언트가 보낸 Session ID와 서버 메모리로 관리하고 있는 Session ID를 비교하여 인증을 수행
- 장단점
- stateful 특징을 가진다.
- 세션 ID 자체를 탈취하여 클라이언트인 척 위장 가능성
- 서버에서 세션 저장소를 사용하므로 요청이 많아지면 서버에 부하가 심해진다.

### 토큰

클라이언트가 서버에 접속하면 서버에서 인증되었다는 의미로 해당 클라이언트에 토큰을 부여하는 방식이다.

⇒토큰은 유일하다.

- 인증 과정
- 로그인 → 서버 접속 → 클라이언트한테 토큰 부여
- 클라이언트가 토큰을 쿠키나 스토리지에 저장
- 서버에 요청 시 헤더에 토큰 심어서 보낸다.
- 서버는 받은 토큰을 자기가 제공한 토큰과 일치한 지 체크한다.
- 장단점
- 서버의 부담이 줄어든다.
- stateless 특징을 가진다.
- 인증 요청이 많아질수록 네트워크 부하가 심해질 수 있다.
- Payload 자체는 암호화되지 않기 때문에 유저의 중요한 정보는 담을 수 없다.
- 토큰 탈취 시 대처가 어렵다.


- 엑세스 토큰과 리프레시 토큰이란?

### Access Token

클라이언트가 갖고 있는 실제로 유저의 정보가 담긴 토큰으로, 클라이언트에서 요청이 오면 서버에서 해당 토큰에 있는 정보를 활용

- 장단점
- Access Token이 탈취되면 토큰이 만료되기 전까지, 토큰이 있는 사람은 누구나 권한 접근이 가능해진다.

### Refresh Token

새로운 Access Token을 발급해주기 위해 사용하는 토큰으로 짧은 수명을 가지는 Access Token에게 새로운 토큰을 발급해주기 위해 사용. 데이터베이스에 유저 정보와 같이 기록

⇒ 똑같은 JWT 토큰이지만 행하는 역할이 다르다.

- 인증 과정
- 로그인 → Access Token, Refresh Token 모두 발급
(refresh token만 서버 측 DB에 저장)
- 사용자가 인증이 필요한 API에 접근하고자 하면, 가장 먼저 토큰을 검사한다.
- access token, refresh token 모두 만료된 경우
→ 에러 발생(재로그인하여 둘 다 새로 발급)
- access token 만료, refresh token 유효
→ refresh token을 검증하여 access token 재발급
- access token 유효, refresh token 만료
→ access token을 검증하여 refresh token 재발급
- access token, refresh token 모두 유효 → 정상
- 로그아웃을 하면 Access Token, Refresh Token을 모두 만료

- OAuth 1.0과 OAuth 2.0의 차이는?

### OAuth: Open Authorization

인터넷 사용자들이 비밀번호를 제공하지 않고,
다른 웹사이트 상의 자신들의 정보에 대해 웹사이트나 애플리케이션의 접근 권한을
부여할 수 있는 공통적인 수단으로 사용되는 접근 위임을 위한 개방형 표준입니다.

- 장단점
- 연동되는 외부 Web Application 에서 카카오톡, Google, Github 등이
제공하는 기능을 간편하게 사용할 수 있다.

- OAuth 1.0
- 총 고객, 고객을 이용하려는 애플리케이션, 고객 정보를 가지고 있는 애플리케이션
이렇게 3개가 상호작용하는 형태이다.
- 장단점
- 구현이 복잡하다 → 암호화를 하는 번거로움
- 인증토큰이 만료 되지 않아 토큰을 만료하려면 애플리케이션의 비밀번호를 바꿔야 함.

- OAuth 2.0 ⇒ 간소화된 인증 프로토
- 기능의 단순화, 기능과 규모의 확장성 등을 지원하기 위해 만들어졌다.
- 다양한 인증 방식이 제공된다.
- https 이용
Binary file added mission/chapter09/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter09/img_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions mission/chapter09/mission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-피어리뷰(스프링 A팀 빈)

-미션기록

![img_2.png](img_2.png)
![img_3.png](img_3.png)
![img_4.png](img_4.png)
![img_5.png](img_5.png)
![img_6.png](img_6.png)
![img_7.png](img_7.png)