pub struct AuthInterceptor { /* private fields */ }Expand description
A CallInterceptor that injects Authorization headers from a
CredentialsStore.
On each before() call it looks up the credential for the current session
using the configured scheme (default: "bearer"). If found, it adds:
Authorization: Bearer <token>to req.extra_headers.
Implementations§
Source§impl AuthInterceptor
impl AuthInterceptor
Sourcepub fn new(
store: Arc<dyn CredentialsStore>,
session: SessionId,
) -> AuthInterceptor
pub fn new( store: Arc<dyn CredentialsStore>, session: SessionId, ) -> AuthInterceptor
Creates an AuthInterceptor that injects bearer tokens.
Sourcepub fn with_scheme(
store: Arc<dyn CredentialsStore>,
session: SessionId,
scheme: impl Into<String>,
) -> AuthInterceptor
pub fn with_scheme( store: Arc<dyn CredentialsStore>, session: SessionId, scheme: impl Into<String>, ) -> AuthInterceptor
Creates an AuthInterceptor with a custom auth scheme.
Trait Implementations§
Source§impl CallInterceptor for AuthInterceptor
impl CallInterceptor for AuthInterceptor
Source§fn before<'a>(
&'a self,
req: &'a mut ClientRequest,
) -> impl Future<Output = Result<(), ClientError>> + Send + 'a
fn before<'a>( &'a self, req: &'a mut ClientRequest, ) -> impl Future<Output = Result<(), ClientError>> + Send + 'a
Called before the request is sent. Read more
Source§fn after<'a>(
&'a self,
_resp: &'a ClientResponse,
) -> impl Future<Output = Result<(), ClientError>> + Send + 'a
fn after<'a>( &'a self, _resp: &'a ClientResponse, ) -> impl Future<Output = Result<(), ClientError>> + Send + 'a
Called after a successful response is received.
Auto Trait Implementations§
impl Freeze for AuthInterceptor
impl !RefUnwindSafe for AuthInterceptor
impl Send for AuthInterceptor
impl Sync for AuthInterceptor
impl Unpin for AuthInterceptor
impl UnsafeUnpin for AuthInterceptor
impl !UnwindSafe for AuthInterceptor
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request