sasl::client

Trait Mechanism

Source
pub trait Mechanism {
    // Required methods
    fn name(&self) -> &str;
    fn from_credentials(
        credentials: Credentials,
    ) -> Result<Self, MechanismError>
       where Self: Sized;

    // Provided methods
    fn initial(&mut self) -> Vec<u8>  { ... }
    fn response(&mut self, _challenge: &[u8]) -> Result<Vec<u8>, MechanismError> { ... }
    fn success(&mut self, _data: &[u8]) -> Result<(), MechanismError> { ... }
}
Expand description

A trait which defines SASL mechanisms.

Required Methods§

Source

fn name(&self) -> &str

The name of the mechanism.

Source

fn from_credentials(credentials: Credentials) -> Result<Self, MechanismError>
where Self: Sized,

Creates this mechanism from Credentials.

Provided Methods§

Source

fn initial(&mut self) -> Vec<u8>

Provides initial payload of the SASL mechanism.

Source

fn response(&mut self, _challenge: &[u8]) -> Result<Vec<u8>, MechanismError>

Creates a response to the SASL challenge.

Source

fn success(&mut self, _data: &[u8]) -> Result<(), MechanismError>

Verifies the server success response, if there is one.

Implementors§

Source§

impl Mechanism for Anonymous

Source§

impl Mechanism for Plain

Source§

impl<S: ScramProvider> Mechanism for Scram<S>

Available on crate feature scram only.