pub struct ScramClient<'a> { /* private fields */ }
Expand description
The initial state of the SCRAM mechanism. It’s the entry point for a SCRAM handshake.
Implementations§
Source§impl<'a> ScramClient<'a>
impl<'a> ScramClient<'a>
Sourcepub fn new(
authcid: &'a str,
password: &'a str,
authzid: Option<&'a str>,
) -> Self
pub fn new( authcid: &'a str, password: &'a str, authzid: Option<&'a str>, ) -> Self
Constructs an initial state for the SCRAM mechanism using the provided credentials.
§Arguments
- authcid - An username used for authentication.
- password - A password used to prove that the user is authentic.
- authzid - An username used for authorization. This can be used to impersonate as
authzid
using the credentials ofauthcid
. Ifauthzid
isNone
the authorized username will be the same as the authenticated username.
§Return value
An I/O error is returned if the internal random number generator couldn’t be constructed.
Sourcepub fn with_rng<R: Rng + ?Sized>(
authcid: &'a str,
password: &'a str,
authzid: Option<&'a str>,
rng: &mut R,
) -> Self
pub fn with_rng<R: Rng + ?Sized>( authcid: &'a str, password: &'a str, authzid: Option<&'a str>, rng: &mut R, ) -> Self
Constructs an initial state for the SCRAM mechanism using the provided credentials and a custom random number generator.
§Arguments
- authcid - An username used for authentication.
- password - A password used to prove that the user is authentic.
- authzid - An username used for authorization. This can be used to impersonate as
authzid
using the credentials ofauthcid
. Ifauthzid
isNone
the authorized username will be the same as the authenticated username. - rng: A random number generator used to generate random nonces. Please only use a cryptographically secure random number generator!
Sourcepub fn client_first(self) -> (ServerFirst<'a>, String)
pub fn client_first(self) -> (ServerFirst<'a>, String)
Returns the next state and the first client message.
Call the ServerFirst::handle_server_first
method to continue the SCRAM handshake.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ScramClient<'a>
impl<'a> RefUnwindSafe for ScramClient<'a>
impl<'a> Send for ScramClient<'a>
impl<'a> Sync for ScramClient<'a>
impl<'a> Unpin for ScramClient<'a>
impl<'a> UnwindSafe for ScramClient<'a>
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