Exemplo n.º 1
0
        protected override async Task HandleSignOutAsync(SignOutContext signOutContext)
        {
            // Process the request cookie to initialize members like _sessionKey.
            var ticket = await EnsureCookieTicket();

            var cookieOptions = BuildCookieOptions();

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

            var context = new CookieSigningOutContext(
                Context,
                Options,
                new AuthenticationProperties(signOutContext.Properties),
                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, context.Properties);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Implements the interface method by invoking the related delegate method.
 /// </summary>
 /// <param name="context"></param>
 public virtual Task SigningOut(CookieSigningOutContext context) => OnSigningOut(context);