Crate sasl [] [src]

This crate provides a framework for SASL authentication and a few authentication mechanisms.

Examples

use sasl::{SaslCredentials, SaslSecret, SaslMechanism, Error};
use sasl::mechanisms::Plain;

let creds = SaslCredentials {
    username: "user".to_owned(),
    secret: SaslSecret::Password("pencil".to_owned()),
    channel_binding: None,
};

let mut mechanism = Plain::from_credentials(creds).unwrap();

let initial_data = mechanism.initial().unwrap();

assert_eq!(initial_data, b"\0user\0pencil");

You may look at the tests of mechanisms/scram.rs for examples of more advanced usage.

Usage

You can use this in your crate by adding this under dependencies in your Cargo.toml:

sasl = "*"

Modules

mechanisms

Provides a few SASL mechanisms.

Structs

SaslCredentials

A struct containing SASL credentials.

Enums

Error

A wrapper enum for things that could go wrong in this crate.

SaslSecret

Represents a SASL secret, like a password.

Traits

SaslMechanism

A trait which defines SASL mechanisms.