fix: update JwtService to handle default expiration and add tests for token generation
All checks were successful
Build And Publish Production Image / Build And Publish Production Image (push) Successful in 39s

This commit is contained in:
2026-03-28 03:40:03 -03:00
parent 8f508034d5
commit 2e2e75fe87
5 changed files with 34 additions and 4 deletions

View File

@@ -14,8 +14,10 @@ import java.util.Date
@Service
class JwtService(
@Value("\${app.jwt.secret}") val secret: String,
@Value("\${app.jwt.expiration-ms}") val expirationMs: Long
@Value("\${app.jwt.expiration-ms:86400000}") expirationMsRaw: String
) {
private val expirationMs: Long = expirationMsRaw.toLongOrNull() ?: 86400000L
private val signingKey by lazy {
Keys.hmacShaKeyFor(secret.toByteArray(Charsets.UTF_8))
}