/// <summary> /// This will ensure any impersonation cookie is deleted when a user signs out /// </summary> /// <param name="context"></param> /// <returns></returns> public Task SigningOutAsync(CookieSigningOutContext context) { var cookie = new ImpersonationCookie(context.HttpContext, null); cookie.Delete(); return(Task.CompletedTask); }
/// <summary> /// This will delete the user impersonation cookie, which causes the AuthCookie ValidateAsync event to revert to the original user /// </summary> /// <returns>error message, or null if OK</returns> public string StopImpersonation() { if (!_httpContext.User.InImpersonationMode()) { return("You aren't in impersonation mode."); } _cookie.Delete(); return(null); }