Add token renewal backend

This commit is contained in:
2020-04-26 00:49:42 +02:00
parent 9d1d1b3afb
commit 8061c15b04
10 changed files with 114 additions and 62 deletions
+6 -2
View File
@@ -7,6 +7,7 @@ import io.ktor.application.*
import org.kodein.di.Kodein
import org.kodein.di.generic.bind
import org.kodein.di.generic.instance
import java.util.concurrent.TimeUnit
import javax.sql.DataSource
/**
@@ -29,10 +30,13 @@ fun Application.configurationFeature() {
HikariDataSource(hikariConfig)
}
val simpleJwt = SimpleJWT(environment.config.property("jwt.secret").getString())
val jwtSecret = environment.config.property("jwt.secret").getString()
val authSimpleJwt = SimpleJWT(jwtSecret, 1, TimeUnit.HOURS)
val refreshSimpleJwt = SimpleJWT(jwtSecret, 7, TimeUnit.DAYS)
configurationModule = Kodein.Module("Configuration") {
bind<DataSource>() with instance(dataSource)
bind<SimpleJWT>() with instance(simpleJwt)
bind<SimpleJWT>(tag = "auth") with instance(authSimpleJwt)
bind<SimpleJWT>(tag = "refresh") with instance(refreshSimpleJwt)
}
}