Add JWT auth

This commit is contained in:
2020-04-12 01:10:39 +02:00
parent 66e84d9913
commit 942fb1a1ec
6 changed files with 61 additions and 1 deletions
+5
View File
@@ -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)
}
}
+5 -1
View File
@@ -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 {