Add JWT auth
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package be.vandewalleh.features
|
||||
|
||||
import be.vandewalleh.auth.SimpleJWT
|
||||
import io.ktor.application.Application
|
||||
import org.kodein.di.Kodein
|
||||
import org.kodein.di.generic.bind
|
||||
@@ -27,7 +28,11 @@ fun Application.configurationFeature() {
|
||||
setPassword(password)
|
||||
}
|
||||
}
|
||||
|
||||
val simpleJwt = SimpleJWT(environment.config.property("jwt.secret").getString())
|
||||
|
||||
configurationModule = Kodein.Module("Configuration") {
|
||||
bind<DataSource>() with instance(dataSource)
|
||||
bind<SimpleJWT>() with instance(simpleJwt)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
package be.vandewalleh.features
|
||||
|
||||
import be.vandewalleh.auth.authenticationModule
|
||||
import io.ktor.application.Application
|
||||
import org.kodein.di.Kodein
|
||||
import org.kodein.di.KodeinAware
|
||||
|
||||
fun Application.features() {
|
||||
// must be first to be loaded
|
||||
configurationFeature()
|
||||
|
||||
locationFeature()
|
||||
corsFeature()
|
||||
contentNegotiationFeature()
|
||||
configurationFeature()
|
||||
authenticationModule()
|
||||
}
|
||||
|
||||
abstract class Feature(override val kodein: Kodein) : KodeinAware {
|
||||
|
||||
Reference in New Issue
Block a user