pub struct Credentials<Id, Secret> {
pub id: Id,
pub secret: Secret,
}
Expand description
Defines credentials for a simple login based on an id
and a secret
.
It can be used for API communication, or in a persisting storage like a database using a hasher, see Credentials::hash_secret.
Fields§
§id: Id
The identification of the user, eg. a username.
secret: Secret
The secret of the user, eg. a password.
Implementations§
Source§impl<Id, Secret> Credentials<Id, Secret>
impl<Id, Secret> Credentials<Id, Secret>
Sourcepub fn hash_secret<Hasher>(
self,
hasher: &Hasher,
) -> Result<Credentials<Id, Vec<u8>>, Error>
pub fn hash_secret<Hasher>( self, hasher: &Hasher, ) -> Result<Credentials<Id, Vec<u8>>, Error>
Hashes the secret with the given SecretsHashingService.
Trait Implementations§
Source§impl<Id: Clone, Secret: Clone> Clone for Credentials<Id, Secret>
impl<Id: Clone, Secret: Clone> Clone for Credentials<Id, Secret>
Source§fn clone(&self) -> Credentials<Id, Secret>
fn clone(&self) -> Credentials<Id, Secret>
Returns a duplicate 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<'de, Id, Secret> Deserialize<'de> for Credentials<Id, Secret>where
Id: Deserialize<'de>,
Secret: Deserialize<'de>,
impl<'de, Id, Secret> Deserialize<'de> for Credentials<Id, Secret>where
Id: Deserialize<'de>,
Secret: Deserialize<'de>,
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<Id, Secret> Freeze for Credentials<Id, Secret>
impl<Id, Secret> RefUnwindSafe for Credentials<Id, Secret>where
Id: RefUnwindSafe,
Secret: RefUnwindSafe,
impl<Id, Secret> Send for Credentials<Id, Secret>
impl<Id, Secret> Sync for Credentials<Id, Secret>
impl<Id, Secret> Unpin for Credentials<Id, Secret>
impl<Id, Secret> UnwindSafe for Credentials<Id, Secret>where
Id: UnwindSafe,
Secret: UnwindSafe,
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
Mutably borrows from an owned value. Read more