Beispiel #1
0
        public static IAppBuilder UseHeaderCloak(this IAppBuilder builder, HeaderCloakOptions options)
        {
            builder.Use <HeaderCloakMiddleware>(options);
            builder.UseStageMarker(PipelineStage.PostAcquireState);

            return(builder);
        }
Beispiel #2
0
        public static IAppBuilder UseHeaderCloak(this IAppBuilder builder)
        {
            var options = new HeaderCloakOptions();

            options.HeadersToCloak.Add(HeadersConstants.Server);
            options.HeadersToCloak.Add(HeadersConstants.XSourceFiles);
            options.HeadersToCloak.Add(HeadersConstants.XPoweredBy);
            options.HeadersToCloak.Add(HeadersConstants.XAspNetVersion);
            options.HeadersToCloak.Add(HeadersConstants.XAspNetMvcVersion);

            return(builder.UseHeaderCloak(options));
        }
Beispiel #3
0
        public HeaderCloakMiddleware(OwinMiddleware next, HeaderCloakOptions options)
            : base(next)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options cannot be null");
            }

            if (options.HeadersToCloak == null)
            {
                throw new ArgumentNullException("HeadersToCloak cannot be null");
            }

            this.options = options;
        }