pub struct AccessKeyStrategyBuilder<S = NoStore> { /* private fields */ }Expand description
Builder for AccessKeyStrategy.
Created via AccessKeyStrategy::builder.
Implementations§
Source§impl<S> AccessKeyStrategyBuilder<S>
impl<S> AccessKeyStrategyBuilder<S>
Sourcepub fn audience(self, audience: impl Into<String>) -> Self
pub fn audience(self, audience: impl Into<String>) -> Self
Set the audience for token requests.
Sourcepub fn base_url(self, url: Url) -> Self
pub fn base_url(self, url: Url) -> Self
Override the CTS base URL resolved for this strategy.
Takes precedence over both the CS_CTS_HOST environment variable and
region-derived service discovery. Use it to point a single strategy
instance at a specific CTS host — e.g. a self-hosted CTS, or a local
mock auth server in development — without relying on the process-wide
CS_CTS_HOST, which would redirect every other CTS client sharing the
process.
Sourcepub fn with_token_store<T: TokenStore>(
self,
store: T,
) -> AccessKeyStrategyBuilder<T>
pub fn with_token_store<T: TokenStore>( self, store: T, ) -> AccessKeyStrategyBuilder<T>
Wire an external TokenStore into the strategy.
On every call to get_token, if no token is
cached in memory, the store is consulted before falling back to
re-authenticating with the access key. After every successful refresh
or initial auth, the new token is written back to the store. Use this
from short-lived strategy instances (Edge Functions, Workers, proxy
worker pools) to share a service-token cache across processes.
Returns a new builder with the store type erased into the chain — see
InMemoryTokenStore and
TokenStoreFn for ready-made
implementations.
Source§impl<S: TokenStore> AccessKeyStrategyBuilder<S>
impl<S: TokenStore> AccessKeyStrategyBuilder<S>
Sourcepub fn build(self) -> Result<AccessKeyStrategy<S>, AuthError>
pub fn build(self) -> Result<AccessKeyStrategy<S>, AuthError>
Build the AccessKeyStrategy.
Resolves the base URL in priority order: an explicit base_url
override, then the CS_CTS_HOST environment variable, then service
discovery using the CRN’s region.
Auto Trait Implementations§
impl<S> Freeze for AccessKeyStrategyBuilder<S>where
S: Freeze,
impl<S> RefUnwindSafe for AccessKeyStrategyBuilder<S>where
S: RefUnwindSafe,
impl<S> Send for AccessKeyStrategyBuilder<S>where
S: Send,
impl<S> Sync for AccessKeyStrategyBuilder<S>where
S: Sync,
impl<S> Unpin for AccessKeyStrategyBuilder<S>where
S: Unpin,
impl<S> UnsafeUnpin for AccessKeyStrategyBuilder<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for AccessKeyStrategyBuilder<S>where
S: UnwindSafe,
Blanket Implementations§
impl<T> AuthStrategyBounds for T
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
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>
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>
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