Struct Authentication

Source
pub struct Authentication {
    pub method: String,
    pub data: Vec<u8>,
}
Expand description

By default, Connect packets provide optional user_name and password fields which can be used to provide basic authentication. Enhanced authentication can be provided by using an Authentication structure which will initialize a challenge / response style authentication. Ii might imply the exchange of several Auth with reason code ContinueAuthentication until eventually one is send with either Success or any relevant error code and, in that case, close the connection. The authentication method which is used as an agreement on how authentication exchanges will perform. Authentication data can be sent at any moment according to this agreement. See the section 4.12 (Enhanced Authentication) of the MQTT 5 specifications for examples.

Fields§

§method: String

Specifies the authentication method, such as “SCRAM-SHA-1” or “GS2-KRB5”. The actual support for a given authentication method is up to the server. If the server does not support the requested method, it will respond with a Connack packet with reason code NotAuthorized or BadAuthenticationMethod and close the connection.

§data: Vec<u8>

Authentication may contains data. The content depends on the authentication method.

Implementations§

Source§

impl Authentication

Source

pub async fn write<W: AsyncWrite + Unpin>( self, writer: &mut W, ) -> SageResult<usize>

Write authentication data into writer, returning the written size in case of success.

Trait Implementations§

Source§

impl Clone for Authentication

Source§

fn clone(&self) -> Authentication

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Authentication

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Authentication

Source§

fn default() -> Authentication

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Authentication

Source§

fn eq(&self, other: &Authentication) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Authentication

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.