-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feat #133 코틀린 마이그레이션 (build.gradle -> build.gradle.kts 로 변경, 의존성 버전 변경) #132
Changes from 6 commits
0bc04eb
4ef469a
acb5bc5
2f7ee4e
f0cbba0
4f7d838
c87a60b
292571f
034a018
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tasks.jar { | ||
enabled = true | ||
} | ||
|
||
tasks.bootJar { | ||
enabled = false | ||
} | ||
|
||
plugins { | ||
id("org.springframework.boot") | ||
id("io.spring.dependency-management") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":account-api:account-domain")) | ||
implementation(project(":common")) | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tasks.jar { | ||
enabled = true | ||
} | ||
|
||
tasks.bootJar { | ||
enabled = false | ||
} | ||
|
||
dependencies { | ||
implementation(project(":common")) | ||
implementation("jakarta.persistence:jakarta.persistence-api:${Version.jakartaPersistenceApi}") | ||
implementation("org.hibernate:hibernate-core:${Version.hibernateCore}") | ||
testImplementation("org.assertj:assertj-core") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
tasks.jar { | ||
enabled = true | ||
} | ||
|
||
tasks.bootJar { | ||
enabled = false | ||
} | ||
|
||
plugins { | ||
JiwonDev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id("org.springframework.boot") | ||
id("io.spring.dependency-management") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":account-api:account-domain")) | ||
implementation(project(":common")) | ||
implementation("io.jsonwebtoken:jjwt-api:${Version.jjwt}") | ||
implementation("io.jsonwebtoken:jjwt-impl:${Version.jjwt}") | ||
implementation("io.jsonwebtoken:jjwt-jackson:${Version.jjwt}") | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
package kr.flab.movieon.account.infrastructure.jwt.impl; | ||
|
||
import io.jsonwebtoken.Claims; | ||
import io.jsonwebtoken.ExpiredJwtException; | ||
import io.jsonwebtoken.Jws; | ||
import io.jsonwebtoken.Jwts; | ||
import io.jsonwebtoken.MalformedJwtException; | ||
import io.jsonwebtoken.UnsupportedJwtException; | ||
import io.jsonwebtoken.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아마 이렇게 하면 나중에 Kotlin의 Ktlint가 wildcards import에 대해 싫은 소리를 할 거 같긴 한데... wildcards import로 싫은 소리 못하게 rule을 추가해버리죠ㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import io.jsonwebtoken.security.Keys; | ||
import java.nio.charset.StandardCharsets; | ||
import java.security.Key; | ||
import java.util.List; | ||
import kr.flab.movieon.account.infrastructure.jwt.AlreadyTokenExpiredException; | ||
import kr.flab.movieon.account.infrastructure.jwt.RawToken; | ||
import kr.flab.movieon.account.infrastructure.jwt.TokenParser; | ||
|
@@ -18,6 +10,10 @@ | |
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.crypto.SecretKey; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.List; | ||
|
||
public final class JwtTokenParser implements TokenParser { | ||
|
||
private final Logger log = LoggerFactory.getLogger(JwtTokenParser.class); | ||
|
@@ -31,17 +27,18 @@ public JwtTokenParser(TokenProperties tokenProperties) { | |
@Override | ||
public RawToken parse(String token) { | ||
try { | ||
Jws<Claims> jwt = Jwts.parserBuilder() | ||
.setSigningKey(getKey(tokenProperties.getBase64TokenSigningKey())) | ||
.build() | ||
.parseClaimsJws(token); | ||
Jws<Claims> jwt = Jwts.parser() | ||
.verifyWith(getKey(tokenProperties.getBase64TokenSigningKey())) | ||
.build() | ||
.parseSignedClaims(token); | ||
|
||
String jti = (String) jwt.getBody().get("jti"); | ||
if (jti == null) { | ||
return new RawToken((String) jwt.getBody().get("email"), | ||
(List<String>) jwt.getBody().get("scopes")); | ||
return new RawToken((String) jwt.getPayload().get("email"), | ||
(List<String>) jwt.getPayload().get("scopes")); | ||
} | ||
return new RawToken((String) jwt.getBody().get("email"), jti, | ||
(List<String>) jwt.getBody().get("scopes")); | ||
(List<String>) jwt.getPayload().get("scopes")); | ||
} catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException ex) { | ||
log.error("Invalid JWT Token", ex); | ||
throw new InvalidTokenException(); | ||
|
@@ -51,7 +48,7 @@ public RawToken parse(String token) { | |
} | ||
} | ||
|
||
private Key getKey(String signKey) { | ||
private SecretKey getKey(String signKey) { | ||
return Keys.hmacShaKeyFor(signKey.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
tasks.jar { | ||
enabled = true | ||
} | ||
|
||
tasks.bootJar { | ||
enabled = false | ||
} | ||
|
||
plugins { | ||
JiwonDev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id("org.springframework.boot") | ||
id("io.spring.dependency-management") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":account-api:account-application")) | ||
implementation(project(":common")) | ||
implementation("org.springdoc:springdoc-openapi-ui:${Version.springdocOpenapi}") | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
implementation("org.springframework.boot:spring-boot-starter-validation") | ||
testImplementation("org.springframework.security:spring-security-test") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
tasks.bootJar { | ||
enabled = true | ||
} | ||
|
||
plugins { | ||
JiwonDev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id("org.springframework.boot") | ||
id("io.spring.dependency-management") | ||
kotlin("plugin.jpa") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":notification-api:notification-presentation")) | ||
implementation(project(":notification-api:notification-application")) | ||
implementation(project(":notification-api:notification-domain")) | ||
implementation(project(":notification-api:notification-infrastructure")) | ||
|
||
implementation(project(":account-api:account-presentation")) | ||
implementation(project(":account-api:account-application")) | ||
implementation(project(":account-api:account-domain")) | ||
implementation(project(":account-api:account-infrastructure")) | ||
|
||
implementation(project(":order-api:order-presentation")) | ||
implementation(project(":order-api:order-application")) | ||
implementation(project(":order-api:order-domain")) | ||
implementation(project(":order-api:order-infrastructure")) | ||
|
||
implementation(project(":payment-api:payment-presentation")) | ||
implementation(project(":payment-api:payment-application")) | ||
implementation(project(":payment-api:payment-domain")) | ||
implementation(project(":payment-api:payment-infrastructure")) | ||
|
||
implementation(project(":product-api:product-presentation")) | ||
implementation(project(":product-api:product-application")) | ||
implementation(project(":product-api:product-domain")) | ||
implementation(project(":product-api:product-infrastructure")) | ||
|
||
implementation(project(":query-api")) | ||
implementation(project(":common")) | ||
|
||
implementation("org.springdoc:springdoc-openapi-ui:${Version.springdocOpenapi}") | ||
implementation("org.springdoc:springdoc-openapi-security:${Version.springdocOpenapi}") | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
implementation("org.springframework.boot:spring-boot-starter-validation") | ||
implementation("org.springframework.boot:spring-boot-starter-amqp") | ||
implementation("it.ozimov:embedded-redis:${Version.embeddedRedis}") { | ||
exclude(group = "org.slf4j", module = "slf4j-simple") | ||
} | ||
runtimeOnly("com.mysql:mysql-connector-j") | ||
implementation("org.flywaydb:flyway-mysql") | ||
testImplementation("com.h2database:h2") | ||
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter:${Version.fixtureMonkey}") | ||
// com.navercorp.fixturemonkey - org.glassfish:jakarta.el:3.0.3 보안 이슈로 버전 변경 (CVE-2021-28170) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 주석에 대한 링크도 같이 걸어주시면 좋을 것 같긴 합니다ㅎㅎ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 링크를 남겨두니까, 오래된 코드에선 한번씩 링크가 유효하지 않은 경우가 있어서 당황스럽더라구요. |
||
testImplementation("org.glassfish:jakarta.el:3.0.4") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PN 룰에 따라 P4로 얘기해보면 plugins가 가장 위에 배치되는건 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 순서는 큰 생각없이 적어둔거라 plugins를 제일 위로 올려두겠습니다