Files
SnowcloakServer/MareSynchronosServer/MareSynchronosShared/Utils/AllowedControllersFeatureProvider.cs
2025-08-22 11:55:35 +01:00

23 lines
631 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Mvc.Controllers;
using System.Reflection;
using Microsoft.Extensions.Logging;
namespace MareSynchronosShared.Utils;
public class AllowedControllersFeatureProvider : ControllerFeatureProvider
{
private readonly ILogger _logger;
private readonly Type[] _allowedTypes;
public AllowedControllersFeatureProvider(params Type[] allowedTypes)
{
_allowedTypes = allowedTypes;
}
protected override bool IsController(TypeInfo typeInfo)
{
return base.IsController(typeInfo) && _allowedTypes.Contains(typeInfo.AsType());
}
}