static async Task OnRemoteSignOut(RemoteSignOutContext context)
        {
            Debug.WriteLine($"11. Begin {nameof(OnRemoteSignOut)}");
            await onRemoteSignOut(context);

            Debug.WriteLine($"11. End - {nameof(OnRemoteSignOut)}");
        }
            public async Task <RemoteSignOutContext> HandleRemoteSignOut(HttpContext context, AuthenticationScheme scheme, SpidOptions options, LogoutResponseType message)
            {
                var remoteSignOutContext = new RemoteSignOutContext(context, scheme, options, message);
                await _events.RemoteSignOut(remoteSignOutContext);

                return(remoteSignOutContext);
            }
Example #3
0
        private async Task OnSignedOutCallbackRedirectAsync(RemoteSignOutContext context)
        {
            _logger.LogDebug($"12. Begin {nameof(OnSignedOutCallbackRedirectAsync)}");
            await s_onSignedOutCallbackRedirect(context).ConfigureAwait(false);

            _logger.LogDebug($"12. End {nameof(OnSignedOutCallbackRedirectAsync)}");
        }
Example #4
0
        private async Task OnRemoteSignOutAsync(RemoteSignOutContext context)
        {
            _logger.LogDebug($"11. Begin {nameof(OnRemoteSignOutAsync)}");
            await s_onRemoteSignOut(context).ConfigureAwait(false);

            _logger.LogDebug($"11. End - {nameof(OnRemoteSignOutAsync)}");
        }
Example #5
0
        private async Task OnSignedOutCallbackRedirectAsync(RemoteSignOutContext context)
        {
            _logger.LogDebug(string.Format(CultureInfo.InvariantCulture, LogMessages.MethodBegin, nameof(OnSignedOutCallbackRedirectAsync)));
            await s_onSignedOutCallbackRedirect(context).ConfigureAwait(false);

            _logger.LogDebug(string.Format(CultureInfo.InvariantCulture, LogMessages.MethodEnd, nameof(OnSignedOutCallbackRedirectAsync)));
        }
Example #6
0
        private static async Task OnRemoteSignOutAsync(RemoteSignOutContext context)
        {
            Debug.WriteLine($"11. Begin {nameof(OnRemoteSignOutAsync)}");
            await s_onRemoteSignOut(context).ConfigureAwait(false);

            Debug.WriteLine($"11. End - {nameof(OnRemoteSignOutAsync)}");
        }
Example #7
0
        private static async Task OnSignedOutCallbackRedirectAsync(RemoteSignOutContext context)
        {
            Debug.WriteLine($"12. Begin {nameof(OnSignedOutCallbackRedirectAsync)}");
            await s_onSignedOutCallbackRedirect(context).ConfigureAwait(false);

            Debug.WriteLine($"12. End {nameof(OnSignedOutCallbackRedirectAsync)}");
        }
Example #8
0
    /// <summary>
    /// Handles wsignoutcleanup1.0 messages sent to the RemoteSignOutPath
    /// </summary>
    /// <returns></returns>
    protected virtual async Task <bool> HandleRemoteSignOutAsync()
    {
        // ToArray handles the StringValues.IsNullOrEmpty case. We assume non-empty Value does not contain null elements.
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
        var message = new WsFederationMessage(Request.Query.Select(pair => new KeyValuePair <string, string[]>(pair.Key, pair.Value.ToArray())));
#pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.

        var remoteSignOutContext = new RemoteSignOutContext(Context, Scheme, Options, message);
        await Events.RemoteSignOut(remoteSignOutContext);

        if (remoteSignOutContext.Result != null)
        {
            if (remoteSignOutContext.Result.Handled)
            {
                Logger.RemoteSignOutHandledResponse();
                return(true);
            }
            if (remoteSignOutContext.Result.Skipped)
            {
                Logger.RemoteSignOutSkipped();
                return(false);
            }
        }

        Logger.RemoteSignOut();

        await Context.SignOutAsync(Options.SignOutScheme);

        return(true);
    }
        static async Task OnSignedOutCallbackRedirect(RemoteSignOutContext context)
        {
            Debug.WriteLine($"12. Begin {nameof(OnSignedOutCallbackRedirect)}");
            await onSignedOutCallbackRedirect(context);

            Debug.WriteLine($"12. End {nameof(OnSignedOutCallbackRedirect)}");
        }
        public async Task TrySignOutLocalSession(RemoteSignOutContext context)
        {
            if (!string.Equals(context.Request.Method, HttpMethod.Post.ToString(), StringComparison.OrdinalIgnoreCase) ||
                context.Request.ContentLength == null || context.Request.ContentLength.Value <= 0)
            {
                return;
            }

            var backchannelLogoutInvocation = await new StreamReader(context.Request.Body).ReadToEndAsync();

            if (!context.Options.SecurityTokenValidator.CanReadToken(backchannelLogoutInvocation))
            {
                return;
            }

            var idpServerConfiguration = await context.Options.ConfigurationManager.GetConfigurationAsync(CancellationToken.None);

            var claimsPrincipal = context.Options.SecurityTokenValidator.ValidateToken(
                backchannelLogoutInvocation,
                new TokenValidationParameters()
            {
                IssuerSigningKeys = idpServerConfiguration.SigningKeys,
                ValidateAudience  = false,
                ValidateIssuer    = false,
                ValidateLifetime  = false
            }, out _);

            var sessionId = claimsPrincipal.FindFirst(c => c.Type == "adapterSessionIds")?.Value;

            if (sessionId != null)
            {
                _sessionRevocationRepo.Save(new SessionRevocationRecord()
                {
                    SessionId = sessionId,
                    Reason    = "用户从外部身份服务处登出"
                });
                context.HandleResponse();
            }
        }
 private static Task OnRemoteSignOut(RemoteSignOutContext context)
 {
     return(Task.FromResult(0));
 }
Example #12
0
 /// <summary>
 /// Invoked before redirecting to the <see cref="OpenIdConnectOptions.SignedOutRedirectUri"/> at the end of a remote sign-out flow.
 /// </summary>
 public virtual Task SignedOutCallbackRedirect(RemoteSignOutContext context) => OnSignedOutCallbackRedirect(context);
 private Task RemoteSignOut(RemoteSignOutContext context)
 {
     _logger.LogDebug("RemoteSignOut!");
     return(Task.FromResult(0));
 }
Example #14
0
 public override Task RemoteSignOut(RemoteSignOutContext context)
 {
     return(base.RemoteSignOut(context));
 }
Example #15
0
        public Task RemoteSignOut(RemoteSignOutContext context)
        {
            _logger.LogInformation("Remote Sign Out", context.ProtocolMessage);

            return(Task.FromResult(0));
        }
Example #16
0
 public override Task RemoteSignOut(RemoteSignOutContext context)
 {
     GetLogger(context).LogCallerMethodName();
     return(base.RemoteSignOut(context));
 }
Example #17
0
 public override Task SignedOutCallbackRedirect(RemoteSignOutContext context)
 {
     GetLogger(context).LogCallerMethodName();
     return(base.SignedOutCallbackRedirect(context));
 }
Example #18
0
 /// <summary>
 /// Invoked when a wsignoutcleanup request is received at the RemoteSignOutPath endpoint.
 /// </summary>
 public virtual Task RemoteSignOut(RemoteSignOutContext context) => OnRemoteSignOut(context);
Example #19
0
 private Task RemoteSignOut(RemoteSignOutContext arg)
 {
     return(Task.FromResult(0));
 }
Example #20
0
 private static Task OnSignedOutCallbackRedirect(RemoteSignOutContext context)
 {
     return(Task.FromResult(0));
 }