pub struct StaticTokenProvider { /* private fields */ }Expand description
A TokenProvider that always returns the same static bearer token.
Suitable for development, testing, or clusters where a single long-lived
token is acceptable. For production workloads with token rotation, implement
TokenProvider directly.
§Debug output
StaticTokenProvider implements Debug but redacts the token value so
that secrets are not accidentally leaked into logs:
use armada_client::StaticTokenProvider;
let p = StaticTokenProvider::new("super-secret");
assert_eq!(format!("{p:?}"), "StaticTokenProvider { token: \"[redacted]\" }");Implementations§
Source§impl StaticTokenProvider
impl StaticTokenProvider
Sourcepub fn new(token: impl Into<String>) -> Self
pub fn new(token: impl Into<String>) -> Self
Create a new StaticTokenProvider from a raw bearer token string.
Pass the raw token value without the "Bearer " scheme prefix —
the prefix is added automatically. If the value already starts with
"Bearer " (e.g. copied from an HTTP header) it is stripped first so
the header is never double-prefixed. Pass an empty string for
unauthenticated clusters:
use armada_client::StaticTokenProvider;
let provider = StaticTokenProvider::new("my-bearer-token");
let same = StaticTokenProvider::new("Bearer my-bearer-token"); // identical result
let also = StaticTokenProvider::new("bearer my-bearer-token"); // also identical
let empty = StaticTokenProvider::new(""); // unauthenticatedTrait Implementations§
Source§impl Debug for StaticTokenProvider
impl Debug for StaticTokenProvider
Auto Trait Implementations§
impl Freeze for StaticTokenProvider
impl RefUnwindSafe for StaticTokenProvider
impl Send for StaticTokenProvider
impl Sync for StaticTokenProvider
impl Unpin for StaticTokenProvider
impl UnsafeUnpin for StaticTokenProvider
impl UnwindSafe for StaticTokenProvider
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