pub fn bearer_auth(token: impl Into<String>) -> BearerAuthLayerExpand description
Builds a BearerAuthLayer that requires Authorization: Bearer <token>
on every request except (by default) the health routes.
§Panics
Panics if token is empty or contains only whitespace. A blank
configured secret is never intentional - it is either a wiring bug (the
real token wasn’t threaded through, e.g. an empty env var) or it would
accept a blank Authorization: Bearer header, which is functionally no
auth at all while looking like auth is configured. Failing fast at
construction is safer than accepting a broken configuration and starting
to accept blank tokens.