I have the following code: ``` route(loginP...
# ktor
m
I have the following code:
Copy code
route(loginPath) {
            authentication {
                basicAuthentication("HOYLU") { credentials ->
                    val email = credentials.name.toLowerCase(Locale.ROOT)
                    val userPass = credentials.password
                    ldapAuth(UserEmailCredential(email, userPass))
                }
            }

            get {
                val claims = call.authentication.principal<Person>()?.let { generateClaims(it) } ?: throw RuntimeException("Error generating claims")
                val jwt = generateJwt(claims)
                jwtHandler.store(claims.getStringClaimValue("email"), jwt)
                call.respond(JsonResponse(AuthToken(jwt)))
            }

            options {
                call.response.headers.append("Access-Control-Allow-Origin", "*")
                call.response.headers.append("Access-Control-Allow-Methods", "GET, OPTIONS")
                call.response.status(HttpStatusCode.OK)
            }
        }