Document that Authenticator does the Base64 encoding and decoding.

This commit is contained in:
Kim Minh Kaplan 2018-11-10 09:15:23 +00:00
parent c2c7e2a3f7
commit 033c23ef11

View file

@ -1,5 +1,16 @@
/// This will allow plugable authentication mechanisms.
///
/// This trait is used by `Client::authenticate` to [authenticate
/// using SASL](https://tools.ietf.org/html/rfc3501#section-6.2.2).
pub trait Authenticator {
/// Type of the response to the challenge. This will usually be a
/// `Vec<u8>` or `String`. It must not be Base64 encoded: the
/// library will do it.
type Response: AsRef<[u8]>;
/// For each server challenge is passed to `process`. The library
/// has already decoded the Base64 string into bytes.
///
/// The `process` function should return its response, not Base64
/// encoded: the library will do it.
fn process(&self, &[u8]) -> Self::Response;
}