-
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
Showing
9 changed files
with
40 additions
and
50 deletions.
There are no files selected for viewing
9 changes: 4 additions & 5 deletions
9
smeem-application/src/main/java/com/smeem/application/domain/auth/SecretKeyFactory.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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
package com.smeem.application.domain.auth; | ||
|
||
import com.smeem.common.util.SmeemProperty; | ||
import com.smeem.application.config.SmeemProperties; | ||
import io.jsonwebtoken.security.Keys; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.val; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.crypto.SecretKey; | ||
|
||
import static java.util.Base64.getEncoder; | ||
import java.util.Base64; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class SecretKeyFactory { | ||
private final SmeemProperty smeemProperty; | ||
private final SmeemProperties smeemProperties; | ||
|
||
public SecretKey create() { | ||
val encodedKey = getEncoder().encodeToString(smeemProperty.getSMEEM_SECRET_KEY().getBytes()); | ||
val encodedKey = Base64.getEncoder().encodeToString(smeemProperties.getSecret().getKey().getBytes()); | ||
return Keys.hmacShaKeyFor(encodedKey.getBytes()); | ||
} | ||
} |
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
10 changes: 5 additions & 5 deletions
10
smeem-batch/src/main/java/com/smeem/batch/scheduler/DiaryScheduler.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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package com.smeem.batch.scheduler; | ||
|
||
import com.smeem.application.config.SmeemProperties; | ||
import com.smeem.application.port.input.DiaryUseCase; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import lombok.val; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class DiaryScheduler { | ||
private final DiaryUseCase diaryUseCase; | ||
|
||
@Value("${smeem.duration.expired}") | ||
private int DURATION_EXPIRED; | ||
private final SmeemProperties smeemProperties; | ||
|
||
@Scheduled(cron = "0 0 0 * * *") | ||
public void deleteExpiredDiaries() { | ||
diaryUseCase.deleteExpiredDiaries(DURATION_EXPIRED); | ||
val expiredDuration = smeemProperties.getDuration().expired(); | ||
diaryUseCase.deleteExpiredDiaries(expiredDuration); | ||
} | ||
} |
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
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