Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

리프레시 토큰 로컬 캐시로 저장소 변경 #206

Merged
merged 7 commits into from
Dec 6, 2023

Conversation

stophwan
Copy link
Member

@stophwan stophwan commented Dec 5, 2023

Issue

Close #205

✅ 작업 내용

  • 리프레시 토큰의 저장소를 레디스에서 로컬 캐시로 변경하였습니다. (만료기간 15일, accessToken은 1시간)
  • 로컬캐시로는 google guava에 cache를 사용하였습니다. 만료시간을 정할 수 있고, concurrentHashMap 기반으로 만들어져 thread-safe하기 때문에 사용하였습니다.
  • https://github.com/google/guava/wiki/CachesExplained

🤔 고민 했던 부분

  • 기존 RefreshToken의 저장소를 redis을 사용했지만 refreshtoken 하나를 위해 redis 컨테이너를 띄우거나 elasticCache를 사용하는것은 오버스펙 같다는 생각이 들었습니다..!
  • 단일서버라는 점과 서비스 특성상 단발적 접속이 많다는 점, 혹여나 서버가 죽어 저장하는 데이터가 없어지더라도 큰 문제가 되지 않는 다는 점에서 로컬 캐시로 구현하는 것이 좋다고 생각했습니다.
  • 처음에는 concurrentHashMap을 사용하고 스케줄러를 통해 관리해줄까 했습니다. 하지만 만료기간을 정할 수 있는 guava의 cache를 사용하였습니다!

@stophwan stophwan changed the title Fix/refresh token 리프레시 토큰 로컬 캐시로 저장소 변경 Dec 5, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #206 (b0b691b) into develop (bf4b455) will increase coverage by 3.36%.
The diff coverage is 92.59%.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #206      +/-   ##
=============================================
+ Coverage      88.92%   92.29%   +3.36%     
- Complexity       882      910      +28     
=============================================
  Files            155      152       -3     
  Lines           2393     2374      -19     
  Branches          58       58              
=============================================
+ Hits            2128     2191      +63     
+ Misses           233      152      -81     
+ Partials          32       31       -1     
Files Coverage Δ
...ebe/auth/adaptor/in/web/token/TokenController.java 100.00% <ø> (+50.00%) ⬆️
...tebe/auth/adaptor/out/InMemoryTokenRepository.java 100.00% <100.00%> (ø)
...auth/application/service/signin/SignInService.java 100.00% <100.00%> (+91.66%) ⬆️
...e/auth/application/service/token/TokenService.java 100.00% <100.00%> (+75.00%) ⬆️
.../auth/application/port/in/AccessTokenResponse.java 90.00% <90.00%> (ø)
...myongjigraduatebe/auth/security/TokenProvider.java 18.18% <50.00%> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf4b455...b0b691b. Read the comment docs.

Copy link
Member

@Hoya324 Hoya324 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다🥹🥹

Copy link
Member

@5uhwann 5uhwann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했슴다

Copy link

sonarqubecloud bot commented Dec 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@stophwan stophwan merged commit 1404120 into develop Dec 6, 2023
6 checks passed
@stophwan stophwan deleted the fix/refresh-token branch December 6, 2023 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RefreshToken 저장소 redis -> local cache
3 participants