authenticateWithAnyOf
Creates a child route that accepts any of the provided typed authentication schemes.
The first scheme that authenticates the call supplies principal inside build. All schemes must produce principals assignable to P. Session schemes may be included, but the route context is always PrincipalContext. Only principal is available inside build; scheme-specific context extensions such as session are not exposed. Each provider is registered lazily on first use and reused on later uses. A different provider with an already registered name is rejected.
authenticateWithAnyOf(apiKeyAuth, bearerAuth) {
get("/api/me") {
call.respondText(call.principal.id)
}
}Parameters
typed schemes accepted by this route.
optional handler invoked when all schemes fail. When omitted, the first scheme-level AuthenticationScheme.onUnauthorized handler is used before default challenges are executed.
route builder with PrincipalContext available as a context parameter.