2024-12-29 18:58:01 -06:00
|
|
|
|
using LANCommander.Server.Services;
|
|
|
|
|
|
using LANCommander.Server.Services.Models;
|
2025-11-16 12:31:25 -06:00
|
|
|
|
using LANCommander.Server.Settings.Models;
|
2024-12-29 18:58:01 -06:00
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
2024-10-07 18:04:26 -05:00
|
|
|
|
|
|
|
|
|
|
namespace LANCommander.Server.Extensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class HttpContextExtensions
|
|
|
|
|
|
{
|
2024-12-29 18:58:01 -06:00
|
|
|
|
public static IEnumerable<AuthenticationProvider> GetExternalProviders(this HttpContext context)
|
2024-10-07 18:04:26 -05:00
|
|
|
|
{
|
2025-11-16 12:31:25 -06:00
|
|
|
|
var settingsProvider = context.RequestServices.GetRequiredService<SettingsProvider<Settings.Settings>>();
|
2024-12-29 18:58:01 -06:00
|
|
|
|
|
2025-11-16 12:31:25 -06:00
|
|
|
|
return settingsProvider.CurrentValue.Server.Authentication.AuthenticationProviders;
|
2024-10-07 18:04:26 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task<bool> IsProviderSupportedAsync(this HttpContext context, string provider)
|
|
|
|
|
|
{
|
2024-12-29 18:58:01 -06:00
|
|
|
|
return true;
|
2024-10-07 18:04:26 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|