#[non_exhaustive]pub enum AuthData {
Password(Password),
ReCaptcha(ReCaptcha),
EmailIdentity(EmailIdentity),
Msisdn(Msisdn),
Dummy(Dummy),
RegistrationToken(RegistrationToken),
FallbackAcknowledgement(FallbackAcknowledgement),
}
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.
Implementations§
§impl AuthData
impl AuthData
pub 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.
pub fn fallback_acknowledgement(session: String) -> AuthData
pub fn fallback_acknowledgement(session: String) -> AuthData
Creates a new AuthData::FallbackAcknowledgement
with the given session key.
pub 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.