Nezteb
04/23/2019, 2:08 AMFilter
right now to validate it, but I also want to put it on the OpenAPI contract for each route. It looks like the only way for me to require that header on every route is to copy-paste the contract header checks?package org.http4k.contract
import org.http4k.core.Filter
import org.http4k.core.Method.OPTIONS
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.core.Status.Companion.UNAUTHORIZED
import org.http4k.lens.Lens
import org.http4k.lens.LensFailure
/**
* Endpoint security. Provides filter to be applied to endpoints for all requests.
*/
interface Security {
val filter: Filter
}
class AuthSecurity(authFilter: (RequestContexts) -> Filter, contexts: RequestContexts) : Security {
override val filter = authFilter(contexts)
}
😄