LANCommander/LANCommander.Server/Extensions/HttpContextExtensions.cs
Pat Hartl add770b227 Refactor Settings
Settings for the server are now combined with the settings from the SDK. This introduces a large breaking change and a migration should be created. This refactor utilizes .NET Configuration and the Options pattern. This will allow for the overriding of any setting using envionment variables. It also means that Settings.yml can be used to override any .NET configuration. A SettingsProvider implementation was created, and any updating of settings was changed from SettingsService.SaveSettings() to SettingsProvider.Update(s => { ... })
2025-11-16 12:31:25 -06:00

22 lines
777 B
C#

using LANCommander.Server.Services;
using LANCommander.Server.Services.Models;
using LANCommander.Server.Settings.Models;
using Microsoft.AspNetCore.Authentication;
namespace LANCommander.Server.Extensions
{
public static class HttpContextExtensions
{
public static IEnumerable<AuthenticationProvider> GetExternalProviders(this HttpContext context)
{
var settingsProvider = context.RequestServices.GetRequiredService<SettingsProvider<Settings.Settings>>();
return settingsProvider.CurrentValue.Server.Authentication.AuthenticationProviders;
}
public static async Task<bool> IsProviderSupportedAsync(this HttpContext context, string provider)
{
return true;
}
}
}