Got at least one data fetching method working; turns out, we can't use a patched LogicStack to get the data

This commit is contained in:
2026-01-14 22:11:11 +01:00
parent 40a8431464
commit 3f7122d30a
350 changed files with 41444 additions and 119 deletions

View File

@@ -0,0 +1,34 @@
using System;
namespace EmbedIO.Authentication
{
/// <summary>
/// Provides extension methods for <see cref="BasicAuthenticationModule"/>.
/// </summary>
public static class BasicAuthenticationModuleExtensions
{
/// <summary>
/// Adds a username and password to the <see cref="BasicAuthenticationModule.Accounts">Accounts</see> dictionary.
/// </summary>
/// <param name="this">The <see cref="BasicAuthenticationModule"/> on which this method is called.</param>
/// <param name="userName">The user name.</param>
/// <param name="password">The password.</param>
/// <returns><paramref name="this"/>, with the user name and password added.</returns>
/// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="userName"/> is <see langword="null"/>.</exception>
/// <exception cref="OverflowException">
/// <para>The <see cref="BasicAuthenticationModule.Accounts">Accounts</see> dictionary already contains
/// the maximum number of elements (<see cref="int.MaxValue">MaxValue</see>).</para>
/// </exception>
/// <remarks>
/// <para>If a <paramref name="userName"/> account already exists,
/// its password is replaced with <paramref name="password"/>.</para>
/// </remarks>
public static BasicAuthenticationModule WithAccount(this BasicAuthenticationModule @this, string userName, string password)
{
@this.Accounts.AddOrUpdate(userName, password, (_, __) => password);
return @this;
}
}
}