digest
fun AuthenticationConfig.digest(name: String? = null, configure: DigestAuthenticationProvider.Config.() -> Unit)(source)
Installs the digest Authentication provider. To learn how to configure it, see Digest authentication.
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.
inline fun <P : Any> digest(name: String, configure: TypedDigestAuthConfig<P>.() -> Unit): SimpleAuthenticationScheme<P>(source)
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) }
}
}Content copied to clipboard
Parameters
name
identifier for this scheme.
configure
configures Digest authentication for this scheme.