#[non_exhaustive]pub enum AuthData {
Password(Password),
ReCaptcha(ReCaptcha),
EmailIdentity(EmailIdentity),
Msisdn(Msisdn),
Dummy(Dummy),
RegistrationToken(RegistrationToken),
FallbackAcknowledgement(FallbackAcknowledgement),
Terms(Terms),
OAuth(OAuth),
}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.
OAuth(OAuth)
OAuth 2.0 (m.oauth).
This type is only valid with the cross-signing keys upload endpoint, after logging in with the OAuth 2.0 API.
Implementations§
Source§impl AuthData
impl AuthData
Sourcepub fn new(
auth_type: &str,
session: Option<String>,
data: JsonObject,
) -> Result<Self>
pub fn new( auth_type: &str, session: Option<String>, data: JsonObject, ) -> Result<Self>
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) -> Self
pub fn fallback_acknowledgement(session: String) -> Self
Creates a new AuthData::FallbackAcknowledgement with the given session key.
Sourcepub fn data(&self) -> Cow<'_, JsonObject>
pub fn data(&self) -> Cow<'_, JsonObject>
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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AuthData
impl RefUnwindSafe for AuthData
impl Send for AuthData
impl Sync for AuthData
impl Unpin for AuthData
impl UnsafeUnpin 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,
§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