digest

Installs the digest Authentication provider. To learn how to configure it, see Digest authentication.

Report a problem


fun AuthenticationConfig.digest(name: String? = null, description: String? = null, configure: DigestAuthenticationProvider.Config.() -> Unit)(source)

Installs the digest Authentication provider with description. To learn how to configure it, see Digest authentication.

Report a problem


Creates a typed Digest authentication scheme.

data class User(val name: String)

val digestAuth = digest<User>("digest-auth") {
realm = "My Realm"
digestProvider { userName, realm, algorithm ->
computeHa1(userName, realm, passwordFor(userName))
}
validate { credential -> User(credential.userName) }
}

routing {
authenticateWith(digestAuth) {
get("/resource") { call.respondText(call.principal.name) }
}
}

Report a problem

Parameters

name

identifier for this scheme.

configure

configures Digest authentication for this scheme.