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) -> Self
pub fn new(store: Arc<dyn CredentialsStore>, session: SessionId) -> Self
Creates an AuthInterceptor that injects bearer tokens.
Sourcepub fn with_scheme(
store: Arc<dyn CredentialsStore>,
session: SessionId,
scheme: impl Into<String>,
) -> Self
pub fn with_scheme( store: Arc<dyn CredentialsStore>, session: SessionId, scheme: impl Into<String>, ) -> Self
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 = ClientResult<()>> + Send + 'a
fn before<'a>( &'a self, req: &'a mut ClientRequest, ) -> impl Future<Output = ClientResult<()>> + Send + 'a
Called before the request is sent. Read more
Source§fn after<'a>(
&'a self,
_resp: &'a ClientResponse,
) -> impl Future<Output = ClientResult<()>> + Send + 'a
fn after<'a>( &'a self, _resp: &'a ClientResponse, ) -> impl Future<Output = ClientResult<()>> + 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> 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> 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