cy
09/25/2018, 12:34 PMapplication.install(Sessions) {
cookie<TestSession>("S") // use cookie S to keep session
}
application.install(Authentication) {
// setup auth provider to take session by type
session<TestSession>("S") {
challenge = SessionAuthChallenge.Ignore // Ignore, Unauthorized or Redirect
validate { UserIdPrincipal(it.name) }
}
}
route("/user") {
authenticate("S") {
get("profile") {
call.respondText("Profile for ${call.principal<UserIdPrincipal>()?.name}.")
}
}
}
// cc @Deactivated User @AdrianTodt @octylFractal @bdawg.io @Nikky