jeremy
03/28/2018, 11:03 PMneworldlt
03/29/2018, 6:35 AMfun Route.userAuth(kodein: Kodein, path: String = "", build: Route.() -> Route) {
route(path) {
authentication {
....
}
build()
}
}
And use it in cases I am needed:
userAuth(kodein,"/user/current") {
get {
call.respond(UserController(kodein).current(call.userId))
}
}
Hope it helps to youorangy
neworldlt
03/29/2018, 2:38 PM<https://github.com/ktorio/ktor/blob/master/ktor-samples/ktor-samples-auth/src/io/ktor/samples/auth/JwtApplication.kt#L33>
👌orangy
jeremy
03/29/2018, 6:29 PM