示例#1
0
        public async Task SignOutAsync(AuthenticationProperties properties)
        {
            _logger.LogDebug($"Entering {nameof(SignOutAsync)}", properties);

            var logoutRequestId = CreateUniqueId();

            properties = properties ?? new AuthenticationProperties();

            properties.Items.Add(LogoutRequestIdKey, logoutRequestId);
            await _sessionStore.SaveAsync <AuthenticationProperties>(properties);

            var sessionIndex = Context.User.GetSessionIndex();
            var subject      = Context.User.GetSubject();

            var logoutRequestUrl = _samlService.GetLogoutRequest(logoutRequestId, sessionIndex, subject, null);

            _logger.LogDebug(
                $"Method={nameof(SignOutAsync)}. Redirecting to saml identity provider for SLO. Url={logoutRequestUrl}");

            Context.Response.Redirect(logoutRequestUrl, true);
        }
        public Task SignOutAsync(AuthenticationProperties properties)
        {
            _logger.LogDebug($"Entering {nameof(SignOutAsync)}", properties);

            var logoutRequestId = CreateUniqueId();
            var cookieOptions   = Options.RequestIdCookie.Build(Context, Clock.UtcNow);

            Response.Cookies.Append(Options.RequestIdCookie.Name, Options.StringDataFormat.Protect(logoutRequestId),
                                    cookieOptions);

            var relayState   = Options.StateDataFormat.Protect(properties);
            var sessionIndex = Context.User.GetSessionIndex();
            var subject      = Context.User.GetSubject();

            var logoutRequestUrl = _samlService.GetLogoutRequest(logoutRequestId, sessionIndex, subject, relayState);

            _logger.LogDebug(
                $"Method={nameof(SignOutAsync)}. Redirecting to saml identity provider for SLO. Url={logoutRequestUrl}");

            Context.Response.Redirect(logoutRequestUrl, true);
            return(Task.CompletedTask);
        }