using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Http; namespace zero.Identity; public class ContextualCookieManager : ChunkingCookieManager, ICookieManager { protected Func Validate { get; private set; } = (ctx, key) => true; public ContextualCookieManager(Func onValidate) { Validate = onValidate; } /// /// Explicitly implement this so that we filter the request /// string ICookieManager.GetRequestCookie(HttpContext context, string key) { return !Validate(context, key) ? null : GetRequestCookie(context, key); } }