pub struct BearerAuth { /* private fields */ }Expand description
Cloneable authentication handle shared by existing gRPC clients.
Refreshing instances publish new tokens through ArcSwap, so clones and
already-created crate::GrpcReplicaFactory values observe updates without
reconnecting. Dropping the last clone stops the refresh task.
Implementations§
Source§impl BearerAuth
impl BearerAuth
Sourcepub fn static_token(token: impl Into<String>) -> Self
pub fn static_token(token: impl Into<String>) -> Self
Create a non-refreshing token handle for tests or controlled deployments.
Prefer google_adc in production.
Sourcepub async fn refreshing(
source: Arc<dyn AccessTokenSource>,
config: RefreshingAuthConfig,
) -> Result<Self, Error>
pub async fn refreshing( source: Arc<dyn AccessTokenSource>, config: RefreshingAuthConfig, ) -> Result<Self, Error>
Create a refreshing handle backed by a custom token source.
Construction fetches and validates the initial token before returning; callers never receive a handle without a usable credential.
Sourcepub async fn google_adc(config: RefreshingAuthConfig) -> Result<Self, Error>
pub async fn google_adc(config: RefreshingAuthConfig) -> Result<Self, Error>
Create the production Google Application Default Credentials path.
The credential requests the GCS read/write scope and refreshes in the
background according to config.
Trait Implementations§
Source§impl Clone for BearerAuth
impl Clone for BearerAuth
Source§fn clone(&self) -> BearerAuth
fn clone(&self) -> BearerAuth
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 moreAuto Trait Implementations§
impl Freeze for BearerAuth
impl RefUnwindSafe for BearerAuth
impl Send for BearerAuth
impl Sync for BearerAuth
impl Unpin for BearerAuth
impl UnsafeUnpin for BearerAuth
impl UnwindSafe for BearerAuth
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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