Struct AutoStrategyBuilder
pub struct AutoStrategyBuilder { /* private fields */ }Expand description
Builder for configuring credential resolution before calling detect().
Explicit values provided via builder methods take precedence over environment variables. Environment variables take precedence over the profile store.
§Example
use stack_auth::AutoStrategy;
// Provide access key explicitly, region from CS_WORKSPACE_CRN env var
let strategy = AutoStrategy::builder()
.with_access_key("CSAKmyKeyId.myKeySecret")
.detect()?;Implementations§
Source§impl AutoStrategyBuilder
impl AutoStrategyBuilder
Sourcepub fn with_access_key(
self,
access_key: impl Into<String>,
) -> AutoStrategyBuilder
pub fn with_access_key( self, access_key: impl Into<String>, ) -> AutoStrategyBuilder
Provide an explicit access key. Takes precedence over env vars.
Sourcepub fn with_workspace_crn(self, crn: Crn) -> AutoStrategyBuilder
pub fn with_workspace_crn(self, crn: Crn) -> AutoStrategyBuilder
Provide an explicit workspace CRN. Takes precedence over env vars.
Sourcepub fn detect(self) -> Result<AutoStrategy, AuthError>
pub fn detect(self) -> Result<AutoStrategy, AuthError>
Resolve the auth strategy.
Resolution order:
- Explicit values provided via builder methods
- Environment variables (
CS_CLIENT_ACCESS_KEY,CS_WORKSPACE_CRN) - Profile store (
~/.cipherstash/auth.jsonfor OAuth) AuthError::NotAuthenticated
Auto Trait Implementations§
impl Freeze for AutoStrategyBuilder
impl RefUnwindSafe for AutoStrategyBuilder
impl Send for AutoStrategyBuilder
impl Sync for AutoStrategyBuilder
impl Unpin for AutoStrategyBuilder
impl UnsafeUnpin for AutoStrategyBuilder
impl UnwindSafe for AutoStrategyBuilder
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
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> 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 more