pub struct BearerTokenAuthInterceptor { /* private fields */ }Expand description
Rejects requests whose Authorization: Bearer <token> is absent or whose
token is not in the allowed set.
For tokens that are validated rather than enumerated (signed JWTs), use
JwtAuthInterceptor (the auth-jwt feature).
Implementations§
Source§impl BearerTokenAuthInterceptor
impl BearerTokenAuthInterceptor
Sourcepub fn new<I, S>(tokens: I) -> BearerTokenAuthInterceptor
pub fn new<I, S>(tokens: I) -> BearerTokenAuthInterceptor
Creates an interceptor accepting any of the given bearer tokens.
Sourcepub fn with_labelled_tokens<I, T, L>(entries: I) -> BearerTokenAuthInterceptor
pub fn with_labelled_tokens<I, T, L>(entries: I) -> BearerTokenAuthInterceptor
Creates an interceptor whose tokens each name the caller they belong to.
See ApiKeyAuthInterceptor::with_labelled_keys for why the label is
separate from the credential rather than derived from it.
Sourcepub fn credentials(&self) -> CredentialSet
pub fn credentials(&self) -> CredentialSet
A handle to the tokens this interceptor accepts, to add or revoke one while it runs (spec §13.4: rotation and revocation).
Trait Implementations§
Source§impl Debug for BearerTokenAuthInterceptor
impl Debug for BearerTokenAuthInterceptor
Source§impl ServerInterceptor for BearerTokenAuthInterceptor
impl ServerInterceptor for BearerTokenAuthInterceptor
Source§fn checks_scheme(&self, scheme: &SecurityScheme) -> Option<bool>
fn checks_scheme(&self, scheme: &SecurityScheme) -> Option<bool>
A bearer token: the HTTP bearer scheme, or the access token of an
OAuth 2.0 or OpenID Connect scheme, which is presented the same way.
Source§fn before<'a>(
&'a self,
ctx: &'a CallContext,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn before<'a>( &'a self, ctx: &'a CallContext, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Called before the request handler processes the method call. Read more
Source§fn after<'a>(
&'a self,
_ctx: &'a CallContext,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn after<'a>( &'a self, _ctx: &'a CallContext, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Called after the request handler has succeeded, before its response
is returned. Read more
Source§fn authenticates(&self) -> bool
fn authenticates(&self) -> bool
Source§fn on_complete<'a>(
&'a self,
ctx: &'a CallContext,
outcome: CallOutcome<'a>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
fn on_complete<'a>( &'a self, ctx: &'a CallContext, outcome: CallOutcome<'a>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
Auto Trait Implementations§
impl Forget for BearerTokenAuthInterceptor
impl Freeze for BearerTokenAuthInterceptor
impl Move for BearerTokenAuthInterceptor
impl RefUnwindSafe for BearerTokenAuthInterceptor
impl Send for BearerTokenAuthInterceptor
impl Sync for BearerTokenAuthInterceptor
impl Unpin for BearerTokenAuthInterceptor
impl UnsafeUnpin for BearerTokenAuthInterceptor
impl UnwindSafe for BearerTokenAuthInterceptor
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].