示例#1
0
        /// <summary>
        /// Invokes the middleware.
        /// </summary>
        /// <param name="context">The <see cref="HttpContext" />.</param>
        public Task Invoke(HttpContext context)
        {
            var feature = context.Features.Get <IResponseCookiesFeature>() ?? new ResponseCookiesFeature(context.Features);
            var wrapper = new ResponseCookiesWrapper(context, Options, feature, _logger);

            context.Features.Set <IResponseCookiesFeature>(new CookiesWrapperFeature(wrapper));
            context.Features.Set <ITrackingConsentFeature>(wrapper);

            return(_next(context));
        }
示例#2
0
 public CookiesWrapperFeature(ResponseCookiesWrapper wrapper)
 {
     Cookies = wrapper;
 }