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
impl Authentication
Sourcepub async fn write<W: AsyncWrite + Unpin>(
self,
writer: &mut W,
) -> SageResult<usize>
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
impl Clone for Authentication
Source§fn clone(&self) -> Authentication
fn clone(&self) -> Authentication
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more