Enum bonsaidb::core::connection::Authentication
source · pub enum Authentication {
Token {
id: u64,
now: LimitedResolutionTimestamp<Nanoseconds, BonsaiEpoch>,
now_hash: Bytes,
algorithm: TokenChallengeAlgorithm,
},
TokenChallengeResponse(Bytes),
Password {
user: NamedReference<'static, u64>,
password: SensitiveString,
},
}
Expand description
Authentication methods.
Variants§
Token
Fields
§
now: LimitedResolutionTimestamp<Nanoseconds, BonsaiEpoch>
The current timestamp of the authenticating device. This must be within 5 minutes of the server’s time for token authentication to succeed.
§
algorithm: TokenChallengeAlgorithm
The token challenge algorithm used to generate now_hash
.
Initialize token-based authentication.
TokenChallengeResponse(Bytes)
A response to the server’s token authentication challenge.
Password
Fields
§
user: NamedReference<'static, u64>
The username or the user id to authenticate as.
§
password: SensitiveString
The password of the user.
Authenticate a user with a password.
Implementations§
source§impl Authentication
impl Authentication
sourcepub fn password<'user, UsernameOrId>(
user: UsernameOrId,
password: SensitiveString
) -> Result<Authentication, Error>
pub fn password<'user, UsernameOrId>( user: UsernameOrId, password: SensitiveString ) -> Result<Authentication, Error>
Returns an authentication instance for this user and password.
sourcepub fn token(id: u64, token: &SensitiveString) -> Result<Authentication, Error>
pub fn token(id: u64, token: &SensitiveString) -> Result<Authentication, Error>
Returns a token authentication initialization instance for this token.
Trait Implementations§
source§impl Clone for Authentication
impl Clone for Authentication
source§fn clone(&self) -> Authentication
fn clone(&self) -> Authentication
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Authentication
impl Debug for Authentication
source§impl<'de> Deserialize<'de> for Authentication
impl<'de> Deserialize<'de> for Authentication
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Authentication, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Authentication, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Serialize for Authentication
impl Serialize for Authentication
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Authentication
impl Send for Authentication
impl Sync for Authentication
impl Unpin for Authentication
impl UnwindSafe for Authentication
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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