// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using MQTTnet.Packets; using MQTTnet.Protocol; namespace MQTTnet.Client { public sealed class MqttExtendedAuthenticationExchangeEventArgs : EventArgs { static readonly IReadOnlyCollection EmptyUserProperties = new List(); public MqttExtendedAuthenticationExchangeEventArgs(MqttAuthPacket authPacket) { if (authPacket == null) { throw new ArgumentNullException(nameof(authPacket)); } ReasonCode = authPacket.ReasonCode; ReasonString = authPacket.ReasonString; AuthenticationMethod = authPacket.AuthenticationMethod; AuthenticationData = authPacket.AuthenticationData; UserProperties = authPacket.UserProperties ?? EmptyUserProperties; } /// /// Gets the authentication data. /// MQTT 5.0.0+ feature. /// public byte[] AuthenticationData { get; } /// /// Gets the authentication method. /// MQTT 5.0.0+ feature. /// public string AuthenticationMethod { get; } /// /// Gets the reason code. /// MQTT 5.0.0+ feature. /// public MqttAuthenticateReasonCode ReasonCode { get; } /// /// Gets the reason string. /// MQTT 5.0.0+ feature. /// public string ReasonString { get; } /// /// Gets or sets the user properties. /// MQTT 5.0.0+ feature. /// public IReadOnlyCollection UserProperties { get; } /// /// Gets the response which will be sent to the server. /// public MqttExtendedAuthenticationExchangeResponse Response { get; } = new MqttExtendedAuthenticationExchangeResponse(); } }