using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace uPLibrary.Networking.M2Mqtt.Managers { /// /// Delegate for executing user authentication /// /// Username /// Password /// public delegate bool MqttUserAuthenticationDelegate(string username, string password); /// /// Manager for User Access Control /// public class MqttUacManager { // user authentication delegate private MqttUserAuthenticationDelegate userAuth; /// /// User authentication method /// public MqttUserAuthenticationDelegate UserAuth { get { return this.userAuth; } set { this.userAuth = value; } } /// /// Execute user authentication /// /// Username /// Password /// Access granted or not public bool UserAuthentication(string username, string password) { if (this.userAuth == null) return true; else return this.userAuth(username, password); } } }