2using System.Collections.Generic;
3using System.Reflection;
4using System.Threading.Tasks;
22 mechanisms = await GetMechanisms();
23 Types.OnInvalidated += Types_OnInvalidated;
31 Types.OnInvalidated -= Types_OnInvalidated;
33 return Task.CompletedTask;
41 private static async
void Types_OnInvalidated(
object Sender, EventArgs e)
45 mechanisms = await GetMechanisms();
53 private static async Task<IAuthenticationMechanism[]> GetMechanisms()
55 Dictionary<string, bool> MechanismsFound =
new Dictionary<string, bool>();
56 List<IAuthenticationMechanism> Result =
new List<IAuthenticationMechanism>();
61 foreach (Type T
in MechanismTypes)
74 if (MechanismsFound.ContainsKey(Mechanism.
Name))
75 throw new Exception(
"Authentication mechanism collision." + T.FullName +
": " + Mechanism.
Name);
79 MechanismsFound[Mechanism.
Name] =
true;
80 Result.Add(Mechanism);
88 Result.Sort((m1, m2) => m2.Weight - m1.Weight);
90 return Result.ToArray();
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Module maintaining available SASL mechanisms.
static IAuthenticationMechanism[] Mechanisms
Available SASL mechanisms.
async Task Start()
Starts the module.
Task Stop()
Stops the module.
Static class that dynamically manages types and interfaces available in the runtime environment.
static Type[] NoTypes
Contains an empty array of types.
static object[] NoParameters
Contains an empty array of parameter values.
static Type[] GetTypesImplementingInterface(string InterfaceFullName)
Gets all types implementing a given interface.
Interface for authentication mechanisms.
Task Initialize()
Performs intitialization of the mechanism. Can be used to set static properties that will be used thr...
string Name
Name of the mechanism.
Interface for late-bound modules loaded at runtime.