Skip to content

Commit

Permalink
Add JWT SecretKey in production env
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Diger committed Dec 9, 2023
1 parent 4653b1b commit b22eba5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class JwtAgentImpl(

private fun buildClaims(user: User): Claims {
val claims = Jwts.claims()
claims.setSubject(user.nickname.nickname)
claims.setSubject(user.nickname.value)
claims["id"] = user.id
return claims
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class KakaoOAuthService(
KakaoLoginResponse::class.java
)

return response.body!!.id!!
return response.body?.id!!
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ fun User.fromDto(): UserEntity = UserEntity(
)

@Embeddable
data class Nickname(val nickname: String) {
data class Nickname(
@Column(name = "nickname")
val value: String
) {
companion object {
fun generateRandomNickname(): Nickname {
return Nickname("random nickname")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ class UserService(
private val userRepository: UserRepository,
) {


@Transactional(readOnly = true)
fun loadByOAuthPayload(payload: String): User? {
val user = userRepository.findByOauthTokenPayload(payload) ?: return null
return user.toDto()
return userRepository.findByOauthTokenPayload(payload)?.toDto()
}

fun create(user: User): User {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
jwt:
secret-key: ENC(nFedRKX5zt00VoNk/11zZcZVAtdnl/AHTDJW74urxj103ameypl1NctWnJYl90thp8OS/DIP8B0oHXgvMVJ02TPFiMZes3Kf3/EPG9t/MnUKvjc4iz1HZ+F76oDcvxXheKiioRZkGt1b0g9iyh7PW4CKSo5T/rScgXsg2c+05bg=)

spring:
config:
activate:
Expand Down

0 comments on commit b22eba5

Please sign in to comment.