-
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
69 changed files
with
701 additions
and
429 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
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
9 changes: 9 additions & 0 deletions
9
smeem-application/src/main/java/com/smeem/application/config/SmeemConfig.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,9 @@ | ||
package com.smeem.application.config; | ||
|
||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(SmeemProperties.class) | ||
public class SmeemConfig { | ||
} |
61 changes: 61 additions & 0 deletions
61
smeem-application/src/main/java/com/smeem/application/config/SmeemProperties.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,61 @@ | ||
package com.smeem.application.config; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import lombok.Getter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.Base64; | ||
|
||
@Getter | ||
@ConfigurationProperties(prefix = "smeem") | ||
public class SmeemProperties { | ||
private final Secret secret; | ||
private final Duration duration; | ||
private final Client client; | ||
|
||
public SmeemProperties(Secret secret, Duration duration, Client client) { | ||
this.secret = secret; | ||
this.duration = duration; | ||
this.client = client; | ||
} | ||
|
||
@Getter | ||
public static class Secret { | ||
private String key; | ||
|
||
public Secret(String key) { | ||
this.key = key; | ||
} | ||
|
||
@PostConstruct | ||
private void init() { | ||
this.key = Base64.getEncoder().encodeToString(key.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} | ||
|
||
public record Duration( | ||
int remind, | ||
int expired | ||
) { | ||
} | ||
|
||
public record Client( | ||
Version version | ||
) { | ||
|
||
public record Version( | ||
String title, | ||
String content, | ||
APP ios, | ||
APP android | ||
) { | ||
|
||
public record APP( | ||
String app, | ||
String force | ||
) { | ||
} | ||
} | ||
} | ||
} |
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
22 changes: 0 additions & 22 deletions
22
smeem-application/src/main/java/com/smeem/application/domain/version/Property.java
This file was deleted.
Oops, something went wrong.
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
17 changes: 0 additions & 17 deletions
17
smeem-application/src/main/java/com/smeem/application/domain/visit/Visit.java
This file was deleted.
Oops, something went wrong.
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
smeem-application/src/main/java/com/smeem/application/port/output/cache/CachePort.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.smeem.application.port.output.cache; | ||
|
||
public interface CachePort { | ||
void setBit(String key, long offset, boolean value); | ||
boolean getBit(String key, long offset); | ||
} |
8 changes: 0 additions & 8 deletions
8
smeem-application/src/main/java/com/smeem/application/port/output/persistence/VisitPort.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
smeem-application/src/main/resources/smeem-config/application-dev.yml
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,15 @@ | ||
smeem: | ||
secret: | ||
key: ${SMEEM_SECRET_KEY} | ||
duration: | ||
remind: ${SMEEM_DURATION_REMIND} | ||
client: | ||
version: | ||
title: ${CLIENT_VERSION_TITLE} | ||
content: ${CLIENT_VERSION_CONTENT} | ||
ios: | ||
app: ${CLIENT_VERSION_IOS_APP} | ||
force: ${CLIENT_VERSION_IOS_FORCE} | ||
android: | ||
app: ${CLIENT_VERSION_ANDROID_APP} | ||
force: ${CLIENT_VERSION_ANDROID_FORCE} |
15 changes: 15 additions & 0 deletions
15
smeem-application/src/main/resources/smeem-config/application-local.yml
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,15 @@ | ||
smeem: | ||
secret: | ||
key: ${SMEEM_SECRET_KEY} | ||
duration: | ||
remind: ${SMEEM_DURATION_REMIND} | ||
client: | ||
version: | ||
title: ${CLIENT_VERSION_TITLE} | ||
content: ${CLIENT_VERSION_CONTENT} | ||
ios: | ||
app: ${CLIENT_VERSION_IOS_APP} | ||
force: ${CLIENT_VERSION_IOS_FORCE} | ||
android: | ||
app: ${CLIENT_VERSION_ANDROID_APP} | ||
force: ${CLIENT_VERSION_ANDROID_FORCE} |
15 changes: 15 additions & 0 deletions
15
smeem-application/src/main/resources/smeem-config/application-prod.yml
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,15 @@ | ||
smeem: | ||
secret: | ||
key: ${SMEEM_SECRET_KEY} | ||
duration: | ||
remind: ${SMEEM_DURATION_REMIND} | ||
client: | ||
version: | ||
title: ${CLIENT_VERSION_TITLE} | ||
content: ${CLIENT_VERSION_CONTENT} | ||
ios: | ||
app: ${CLIENT_VERSION_IOS_APP} | ||
force: ${CLIENT_VERSION_IOS_FORCE} | ||
android: | ||
app: ${CLIENT_VERSION_ANDROID_APP} | ||
force: ${CLIENT_VERSION_ANDROID_FORCE} |
Oops, something went wrong.