-
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
1 parent
dfe9640
commit c35d16a
Showing
3 changed files
with
49 additions
and
36 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/com/hero/alignlab/config/jwt/JwtProperties.kt
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,35 @@ | ||
package com.hero.alignlab.config.jwt | ||
|
||
import com.hero.alignlab.domain.auth.application.JwtTokenService | ||
import io.github.oshai.kotlinlogging.KotlinLogging | ||
import jakarta.validation.constraints.NotBlank | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(JwtConfig.JwtProperties::class) | ||
class JwtConfig { | ||
private val logger = KotlinLogging.logger {} | ||
|
||
@ConfigurationProperties(prefix = "auth.jwt") | ||
data class JwtProperties( | ||
@field:NotBlank | ||
var secret: String = "", | ||
@field:NotBlank | ||
var accessExp: Int = 0, | ||
@field:NotBlank | ||
var refreshExp: Int = 0, | ||
val issuer: String = "hero-alignlab-api", | ||
val audience: String = "hero-alignlab-api", | ||
) | ||
|
||
@Bean | ||
fun jwtTokenService(jwtProperties: JwtProperties): JwtTokenService { | ||
logger.info { "initialized jwtTokenService. $jwtProperties" } | ||
return JwtTokenService(jwtProperties) | ||
} | ||
} | ||
|
||
|
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