public static IServiceCollection AddElectCors(this IServiceCollection services, [NotNull] ElectCorsOptions configuration) { return(services.AddElectCors(_ => { _.PolicyName = configuration.PolicyName; _.AllowOrigins = configuration.AllowOrigins; _.AllowHeaders = configuration.AllowHeaders; _.AllowMethods = configuration.AllowMethods; _.IsAllowCredentials = configuration.IsAllowCredentials; })); }
public ElectCorsMiddleware(RequestDelegate next, IOptions <ElectCorsOptions> configuration) { _next = next; _options = configuration.Value; }