[๐ Assignment/#6] Week6_Seminar_์ค์ต๊ณผ์ ๊ตฌํ #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
๐ Work Description
โจ ๋ก๊ทธ์ธ์ ์งํํ ๋ AccessToken๊ณผ Refresh Token์ ํจ๊ป ๋ฐํํ๋ ๋ก์ง ๊ตฌํ โจ
โจ Redis๋ฅผ ํ์ฉํด Refresh Token์ผ๋ก Access Token์ ์ฌ๋ฐ๊ธ ๋ฐ๋ ๋ก์ง ๊ตฌํ โจ
1๏ธโฃ ํ์๊ฐ์ : JWT ์ธ์ฆ ํํฐ๋ฅผ ๊ฑฐ์น์ง ์์
2๏ธโฃ ๋ก๊ทธ์ธ : JWT ์ธ์ฆ ํํฐ๋ฅผ ๊ฑฐ์น์ง ์์
3๏ธโฃ ๋ธ๋ก๊ทธ ์์ฑ : JWT ์ธ์ฆ ํํฐ๋ฅผ ๊ฑฐ์นจ
4๏ธโฃ ํ ํฐ ์ฌ๋ฐ๊ธ : JWT ์ธ์ฆ ํํฐ๋ฅผ ๊ฑฐ์น์ง ์์
๐ ํ์๊ฐ์ ๋ฐ ๋ก๊ทธ์ธ ์ ํ ํฐ ๋ฐ๊ธ ๋ฐ ์ ์ฅ
๐ ๋ธ๋ก๊ทธ ์์ฑ ์ JWT ์ธ์ฆ ํํฐ๋ฅผ ๊ฑฐ์น๋๋ก ๊ตฌํ
๐ Redis๋ฅผ ํ์ฉํด Refresh Token์ผ๋ก Access Token์ ์ฌ๋ฐ๊ธ ๋ฐ๋ ๋ก์ง ๊ตฌํ
๐ท Screenshot
ํด๋์ค ๊ตฌ์กฐ
๐ ํ์๊ฐ์ ๋ฐ ๋ก๊ทธ์ธ ์ ํ ํฐ ๋ฐ๊ธ ๋ฐ ์ ์ฅ
1. ํ์๊ฐ์ ์ Refresh Token์ ๋ฐ๊ธํ ์ ์๋๋ก UserJoinResponse์ ์ฝ๋ ์ถ๊ฐํ๊ธฐ
2. MemberService ์์ ํ๊ธฐ(refreshToken ๊ด๋ จ ๋ก์ง + ๋ฉค๋ฒ ๊ฐ์ ์ password๋ ํจ๊ป ๋ฐ์์ค๋๋ก ์ฝ๋ ์ถ๊ฐ)
3. JwtTokenProvider์ Refresh Token ๊ด๋ จ ์ฝ๋ ์ถ๊ฐํ๊ธฐ
4. ๋ก๊ทธ์ธ ๋ก์ง ๊ตฌํ์ ์ํ LoginRequest, LoginResponse (record ํ์) ๊ตฌํํ๊ธฐ
5. ๋ก๊ทธ์ธ ์ ์ฌ์ฉ์์ ์๊ฒฉ์ ํ์ธํ๋ ๋น์ฆ๋์ค ๋ก์ง(AuthService) ๊ตฌํํ๊ธฐ
6. AuthController ๊ตฌํํ๊ธฐ
๐ Redis๋ฅผ ํ์ฉํด Refresh Token์ผ๋ก Access Token์ ์ฌ๋ฐ๊ธ ๋ฐ๋ ๋ก์ง ๊ตฌํ
RefreshTokenRequest ๊ตฌํํ๊ธฐ
1. Refresh Token ์ฌ๋ฐ๊ธ ๋ฐ๋ ๋น์ฆ๋์ค ๋ก์ง(AuthService)๊ณผ, ์ถ๊ฐ์ ์ผ๋ก ์กด์ฌํ๋ ํ ํฐ์ธ์ง ํ์ธํ๋ ์์ธ์ฒ๋ฆฌ๋ฅผ ์ถ๊ฐํ์ฌ ๊ตฌํํ๊ธฐ
2. AuthController์ Refresh Token ์ฌ๋ฐ๊ธ ๊ด๋ จ ์ฝ๋ ์ถ๊ฐํ๊ธฐ
์์ธ์ฒ๋ฆฌ
exception ๊ตฌ์กฐ
ErrorMessage.java
Swagger ํ ์คํธ
1. ๋ฉค๋ฒ ์์ฑ ์ RefreshToken๋ ํจ๊ป ๋ฐํ
2. ๋ก๊ทธ์ธ ์ ์ฌ์ฉ์ ์ด๋ฆ์ด ์กด์ฌํ์ง ์๋ ๊ฒฝ์ฐ
3. ๋ก๊ทธ์ธ ์ ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์๋ ๊ฒฝ์ฐ
4. ๋ก๊ทธ์ธ ์ฑ๊ณต
5. Refresh Token์ด ์กด์ฌํ์ง ์๋ ๊ฒฝ์ฐ
6. Refresh Token ์ฌ๋ฐ๊ธ ์ฑ๊ณต