-
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.
- Loading branch information
hyeyeon
committed
Feb 28, 2024
1 parent
48f8faa
commit aa1d890
Showing
6 changed files
with
85 additions
and
33 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
13 changes: 13 additions & 0 deletions
13
...in/src/main/java/sopt/org/motivoo/domain/auth/dto/response/OAuthPlatformMemberResult.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,13 @@ | ||
package sopt.org.motivoo.domain.auth.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record OAuthPlatformMemberResult ( | ||
@JsonProperty("platform_id") | ||
String platformId, | ||
String email | ||
){ | ||
|
||
} |
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
41 changes: 41 additions & 0 deletions
41
...voo-domain/src/main/java/sopt/org/motivoo/domain/auth/repository/TokenRedisRetriever.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,41 @@ | ||
package sopt.org.motivoo.domain.auth.repository; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.data.redis.core.ValueOperations; | ||
import org.springframework.stereotype.Component; | ||
import sopt.org.motivoo.domain.user.exception.UserException; | ||
|
||
import java.util.Date; | ||
|
||
import static sopt.org.motivoo.domain.user.exception.UserExceptionType.TOKEN_NOT_FOUND; | ||
|
||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class TokenRedisRetriever { | ||
private final TokenRedisRepository tokenRedisRepository; | ||
public void saveRefreshToken(String refreshToken, String account) { | ||
tokenRedisRepository.saveRefreshToken(refreshToken, account); | ||
} | ||
|
||
|
||
public void saveBlockedToken(String accessToken) { | ||
tokenRedisRepository.saveBlockedToken(accessToken); | ||
} | ||
|
||
private Date getExpirationFromToken(String accessToken) { | ||
return tokenRedisRepository.getExpirationFromToken(accessToken); | ||
} | ||
|
||
|
||
public String getRefreshToken(String refreshToken) { | ||
return tokenRedisRepository.findByRefreshToken(refreshToken).orElseThrow( | ||
() -> new UserException(TOKEN_NOT_FOUND)); | ||
} | ||
|
||
|
||
public void deleteRefreshToken(String refreshToken) { | ||
tokenRedisRepository.deleteRefreshToken(refreshToken); | ||
} | ||
} |
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