-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from bucket-back/OMCT-411-refresh-token
[OMCT-411] 로그인 연장 기능 추가 - Refresh token으로 Access token 재발급
- Loading branch information
Showing
17 changed files
with
268 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../java/com/programmers/bucketback/domains/member/api/dto/response/AccessTokenResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.programmers.bucketback.domains.member.api.dto.response; | ||
|
||
public record AccessTokenResponse( | ||
String accessToken | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
bucketback-api/src/main/java/com/programmers/bucketback/global/cache/CacheConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.programmers.bucketback.global.cache; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.springframework.cache.CacheManager; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.caffeine.CaffeineCache; | ||
import org.springframework.cache.support.SimpleCacheManager; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
|
||
@EnableCaching | ||
@Configuration | ||
public class CacheConfiguration { | ||
@Bean | ||
public CacheManager cacheManager() { | ||
final List<CaffeineCache> caffeineCaches = Arrays.stream(CacheType.values()) | ||
.map(cache -> new CaffeineCache(cache.getCacheName(), Caffeine.newBuilder().recordStats() | ||
.expireAfterWrite(cache.getExpireAfterWrite(), TimeUnit.SECONDS) | ||
.maximumSize(cache.getEntryMaxSize()) | ||
.build())) | ||
.toList(); | ||
|
||
final SimpleCacheManager cacheManager = new SimpleCacheManager(); | ||
cacheManager.setCaches(caffeineCaches); | ||
|
||
return cacheManager; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
bucketback-api/src/main/java/com/programmers/bucketback/global/cache/CacheType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.programmers.bucketback.global.cache; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum CacheType { | ||
|
||
REFRESH_TOKEN("refreshToken", 1209600, 10000) | ||
; | ||
|
||
private final String cacheName; | ||
private final int expireAfterWrite; | ||
private final int entryMaxSize; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.