pub enum LoginOutcome {
Session(Session),
SecondFactorRequired {
mfa_token: SecretString,
expires_by: u64,
},
}Expand description
What a password login answered with.
Two variants because the server has two outcomes and says so with a status: 200 with a
token pair, 202 with a challenge. Neither is a failure — an account having a second factor
is the system working — which is why this is a value rather than an AuthError variant.
A caller that only supports passwords should match on this and say so, rather than treating the challenge as an error it cannot describe.
No Debug. Session holds live tokens and deliberately has none, and the challenge here is
a credential in its own right — deriving one would put half a sign-in in any log line that
formatted the value.
Variants§
Session(Session)
The account has no second factor, and this is its session.
SecondFactorRequired
The password verified and a code is still needed.
Fields
mfa_token: SecretStringThe challenge to present to
verify_second_factor. Good once, and for five
minutes.
Implementations§
Source§impl LoginOutcome
impl LoginOutcome
Sourcepub fn into_session(self) -> Result<Session, AuthError>
pub fn into_session(self) -> Result<Session, AuthError>
The session, if the sign-in finished.
A convenience for the callers that genuinely cannot prompt — an automated one, or a test against an account known to have no second factor. It returns an error rather than panicking, because “this account needs a code and I cannot ask for one” is a runtime condition rather than a programming mistake.
§Errors
Returns AuthError::SecondFactorRequired when a code is needed.
Auto Trait Implementations§
impl !RefUnwindSafe for LoginOutcome
impl !UnwindSafe for LoginOutcome
impl Freeze for LoginOutcome
impl Send for LoginOutcome
impl Sync for LoginOutcome
impl Unpin for LoginOutcome
impl UnsafeUnpin for LoginOutcome
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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