mod config;
mod mechanism;
use crate::channel_bindings::NoChannelBindings;
use crate::config::SASLConfig;
use crate::registry::Mechanism;
use crate::sasl::Sasl;
use crate::session::{Session, Side};
use crate::typed::Tagged;
pub use config::{client_config, server_config, EmptyCallback};
use std::sync::Arc;
#[must_use]
pub fn client_session(config: Arc<SASLConfig>, mechanism: &Mechanism) -> Session {
let mech = mechanism.client().unwrap().unwrap();
let sasl = Sasl {
config,
cb: NoChannelBindings,
validation: Tagged(None),
};
Session::new(sasl, Side::Client, mech, *mechanism)
}
#[must_use]
pub fn server_session(config: Arc<SASLConfig>, mechanism: &Mechanism) -> Session {
let mech = mechanism.server(&config).unwrap().unwrap();
let sasl = Sasl {
config,
cb: NoChannelBindings,
validation: Tagged(None),
};
Session::new(sasl, Side::Server, mech, *mechanism)
}