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

RefreshToken을 재발급 받을 때 현재 시간을 기준으로 발급 받도록 변경 #528

Merged
merged 5 commits into from
Sep 19, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ private void validateNotNull(final LocalDateTime value) {
}
}

public void plusMinutes(final int minutes) {
this.value = value.plusMinutes(minutes);
public void refreshExpireTokenDate(final int minutes) {
this.value = LocalDateTime.now().plusMinutes(minutes);
}

public boolean isExpired() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void validateNotNull(final Member member, final Token token, final Expir

public void updateToken(final Token token, final int expiredMinutes) {
this.token = token;
expireDate.plusMinutes(expiredMinutes);
expireDate.refreshExpireTokenDate(expiredMinutes);
}

public boolean isNotOwner(final Member member) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.time.LocalDateTime;

import static java.time.LocalDateTime.now;
import static java.time.temporal.ChronoUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
Expand Down Expand Up @@ -99,8 +100,8 @@ void updateToken() {
// then
assertAll(
() -> assertThat(refreshToken.getToken()).isEqualTo(updateToken),
() -> assertThat(refreshToken.getExpireDate()).isEqualTo(new ExpireDate(currentTime.plusMinutes(30)))
);
() -> assertThat(refreshToken.getExpireDate().getValue().truncatedTo(MINUTES))
.isEqualTo((currentTime.plusMinutes(30)).truncatedTo(MINUTES)));
}

@DisplayName("토큰의 주인을 확인할 수 있다.")
Expand Down