auth
ModuleUndocumented.
Contents
use utopia_mqtt::packet::auth::Auth;Rust
pub struct AuthAn AUTH (5.0 only): one step of enhanced authentication, or a re-authentication on an open connection.
Rust
use utopia_mqtt::packet::{Auth, Packet};
use utopia_mqtt::spec::v5;
use utopia_mqtt::{Properties, Property};
let properties = Properties::new().with(Property::bytes(Property::AUTHENTICATION_METHOD, "token"));
let bytes = v5::auth(Auth::REAUTH, Some(&properties))?;
let auth = Auth::decode(Packet::parse(&bytes)?.body)?;
assert_eq!((auth.reason_code, auth.method.as_slice()), (Auth::REAUTH, &b"token"[..]));