Files
Examples/GerstITS.Examples.Api/Common/Configurations/WebApiConfiguration.Server.Headers.cs
2022-12-22 15:29:53 +01:00

29 lines
906 B
C#

using GerstITS.System.Configurations;
using GerstITS.Web.Api.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.HttpOverrides;
namespace GerstITS.Examples.Api.Configurations;
internal sealed class WebApiHeadersConfiguration : IHeaderConfiguration, IConfiguration
{
#region Constructors
public WebApiHeadersConfiguration(string parentPrefix, Microsoft.Extensions.Configuration.IConfiguration configuration)
{
var prefix = $"{parentPrefix}:{this.ToConfigurationPrefix()}";
ForwardedHeaders = new ForwardedHeadersOptions
{
ForwardedHeaders = configuration.GetFlaggedEnum<ForwardedHeaders>($"{prefix}:{nameof(ForwardedHeadersOptions)}:{nameof(ForwardedHeadersOptions.ForwardedHeaders)}")
};
}
#endregion
#region IHeaderConfiguration
public ForwardedHeadersOptions ForwardedHeaders { get; }
#endregion
}