- Changed `TryGet` method return type from `bool?` to `bool` in `BackdoorExtensions.cs` for improved clarity.
- Updated configuration retrieval in `DependencyInjection.cs` to use `GetSection("backdoors")` for targeted loading.
- Added `backdoors.json` configuration file in `Program.cs` to enhance modularity and organization of settings.
16 lines
597 B
C#
16 lines
597 B
C#
namespace DigitalData.Auth.API.Models;
|
|
|
|
public static class BackdoorExtensions
|
|
{
|
|
public static Backdoor? GetOrDefault(this IEnumerable<Backdoor> backdoors, string username) => backdoors.Where(b => b.Username == username).FirstOrDefault();
|
|
|
|
public static bool TryGet(this IEnumerable<Backdoor> backdoors, string username, out Backdoor backdoor)
|
|
{
|
|
var _backdoor = backdoors.Where(b => b.Username == username).FirstOrDefault() ?? default;
|
|
#pragma warning disable CS8601
|
|
backdoor = _backdoor;
|
|
#pragma warning restore CS8601
|
|
return _backdoor is not null;
|
|
}
|
|
}
|