Example #1
0
        public static IApplicationBuilder UseKazooCors(this IApplicationBuilder app, Action <CorsOptions> action)
        {
            var opts = new CorsOptions();

            action.Invoke(opts);
            return(app.UseMiddleware <CorsMiddleware>(opts));
        }
Example #2
0
 public CorsMiddleware(CorsOptions opts, RequestDelegate next)
 {
     _whitelistHosts = opts.WhitelistRemoteHosts
                       .Where(h => !string.IsNullOrWhiteSpace(h))
                       .Select(h => h.ToLowerInvariant().Trim());
     _opts = opts;
     _next = next;
 }