AuthenticationFilter
The http4k Filter that runs the application's Authenticator
on each request. When the authenticator returns Authenticated, the principal is attached to the
request via Request.withPrincipal and any
newCookies are applied to the response. When the authenticator returns Unauthenticated, the request
is forwarded unchanged — access control is left to downstream routes (e.g.
securedRoutes).
- Example
- Declaration
val appHandler = AuthenticationFilter(authenticator)
.then(routes(/* ... */))
object AuthenticationFilter {
operator fun invoke(authenticator: Authenticator): Filter
}