Example #1
0
        protected override async Task HandleSignOutAsync(SignOutContext signOutContext)
        {
            var ticket = await EnsureCookieTicket();

            var cookieOptions = BuildCookieOptions();

            if (Options.SessionStore != null && _sessionKey != null)
            {
                await Options.SessionStore.RemoveAsync(_sessionKey);
            }

            var context = new CookieSigningOutContext(
                Context,
                Options,
                cookieOptions);

            await Options.Events.SigningOut(context);

            Options.CookieManager.DeleteCookie(
                Context,
                Options.CookieName,
                context.CookieOptions);

            // Only redirect on the logout path
            var shouldRedirect = Options.LogoutPath.HasValue && OriginalPath == Options.LogoutPath;

            await ApplyHeaders(shouldRedirect);
        }
 /// <summary>
 /// Implements the interface method by invoking the related delegate method.
 /// </summary>
 /// <param name="context"></param>
 public virtual Task SigningOut(CookieSigningOutContext context) => OnSigningOut(context);
 /// <summary>
 /// Implements the interface method by invoking the related delegate method.
 /// </summary>
 /// <param name="context"></param>
 public virtual Task SigningOut(CookieSigningOutContext context) => OnSigningOut(context);