29 lines
906 B
C#
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
|
|
} |