<@UB61X37CY> I've made a change to add this option...
# http4k
d
@Xavier Hanin I've made a change to add this option to the BearerAuth and BasicAuth Filters. It's releasing now in 3.38.0. New code will look like :
Copy code
val contexts = RequestContexts()

    val credentials = RequestContextKey.required<Credentials>(contexts)

    val app = InitialiseRequestContext(contexts)
            .then(BearerAuth(credentials) { if (it == "42") Credentials("user", "pass") else null })
            .then { Response(OK).body(credentials(it).toString()) }

    println(app(Request(GET, "/").header("Authorization", "Bearer 41")))
    println(app(Request(GET, "/").header("Authorization", "Bearer 42")))