pub struct BearerAuthLayer { /* private fields */ }Expand description
[tower_layer::Layer] that wraps a router (or any inner tower service)
with bearer-token auth.
Construct with bearer_auth. Use Self::allow_unauthenticated_health
to change whether GET /health and GET /v1/health require the token
too (they don’t, by default - see that method’s docs for why).
Implementations§
Source§impl BearerAuthLayer
impl BearerAuthLayer
Sourcepub fn allow_unauthenticated_health(self, allow: bool) -> Self
pub fn allow_unauthenticated_health(self, allow: bool) -> Self
Controls whether GET /health and GET /v1/health (and only those
two paths - not GET /v1/compatibility, which reveals the installed
codex version) are reachable without a token.
Defaults to true: liveness probes rarely carry credentials, and a
bare “is the process up” response leaks nothing sensitive. Set this
to false for deployments where even that is unwanted, e.g. an
operator who wants every request authenticated uniformly regardless
of what it reveals.
Trait Implementations§
Source§impl Clone for BearerAuthLayer
impl Clone for BearerAuthLayer
Source§fn clone(&self) -> BearerAuthLayer
fn clone(&self) -> BearerAuthLayer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S> Layer<S> for BearerAuthLayer
impl<S> Layer<S> for BearerAuthLayer
Auto Trait Implementations§
impl Freeze for BearerAuthLayer
impl RefUnwindSafe for BearerAuthLayer
impl Send for BearerAuthLayer
impl Sync for BearerAuthLayer
impl Unpin for BearerAuthLayer
impl UnsafeUnpin for BearerAuthLayer
impl UnwindSafe for BearerAuthLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more