#[non_exhaustive]pub enum AuthData {
Password(Password),
ReCaptcha(ReCaptcha),
EmailIdentity(EmailIdentity),
Msisdn(Msisdn),
Dummy(Dummy),
RegistrationToken(RegistrationToken),
FallbackAcknowledgement(FallbackAcknowledgement),
Terms(Terms),
}
api
and (crate features client
or server
) only.Expand description
Information for one authentication stage.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Password(Password)
Password-based authentication (m.login.password
).
ReCaptcha(ReCaptcha)
Google ReCaptcha 2.0 authentication (m.login.recaptcha
).
EmailIdentity(EmailIdentity)
Email-based authentication (m.login.email.identity
).
Msisdn(Msisdn)
Phone number-based authentication (m.login.msisdn
).
Dummy(Dummy)
Dummy authentication (m.login.dummy
).
RegistrationToken(RegistrationToken)
Registration token-based authentication (m.login.registration_token
).
FallbackAcknowledgement(FallbackAcknowledgement)
Fallback acknowledgement.
Terms(Terms)
Terms of service (m.login.terms
).
This type is only valid during account registration.
Implementations§
source§impl AuthData
impl AuthData
sourcepub fn new(
auth_type: &str,
session: Option<String>,
data: Map<String, Value>,
) -> Result<AuthData, Error>
pub fn new( auth_type: &str, session: Option<String>, data: Map<String, Value>, ) -> Result<AuthData, Error>
Creates a new AuthData
with the given auth_type
string, session and data.
Prefer to use the public variants of AuthData
where possible; this constructor is meant to
be used for unsupported authentication types only and does not allow setting arbitrary
data for supported ones.
§Errors
Returns an error if the auth_type
is known and serialization of data
to the
corresponding AuthData
variant fails.
sourcepub fn fallback_acknowledgement(session: String) -> AuthData
pub fn fallback_acknowledgement(session: String) -> AuthData
Creates a new AuthData::FallbackAcknowledgement
with the given session key.
sourcepub fn data(&self) -> Cow<'_, Map<String, Value>>
pub fn data(&self) -> Cow<'_, Map<String, Value>>
Returns the associated data.
The returned JSON object won’t contain the type
and session
fields, use
.auth_type()
/ .session()
to access those.
Prefer to use the public variants of AuthData
where possible; this method is meant to be
used for custom auth types only.
Trait Implementations§
source§impl<'de> Deserialize<'de> for AuthData
impl<'de> Deserialize<'de> for AuthData
source§fn deserialize<D>(
deserializer: D,
) -> Result<AuthData, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<AuthData, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Serialize for AuthData
impl Serialize for AuthData
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for AuthData
impl RefUnwindSafe for AuthData
impl Send for AuthData
impl Sync for AuthData
impl Unpin for AuthData
impl UnwindSafe for AuthData
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§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