Example #1
0
    public async Task <IEndpointResult> ProcessAsync(HttpContext context)
    {
        using var activity = Tracing.BasicActivitySource.StartActivity(Constants.EndpointNames.EndSession + "CallbackEndpoint");

        if (!HttpMethods.IsGet(context.Request.Method))
        {
            _logger.LogWarning("Invalid HTTP method for end session callback endpoint.");
            return(new StatusCodeResult(HttpStatusCode.MethodNotAllowed));
        }

        _logger.LogDebug("Processing signout callback request");

        var parameters = context.Request.Query.AsNameValueCollection();
        var result     = await _endSessionRequestValidator.ValidateCallbackAsync(parameters);

        if (!result.IsError)
        {
            _logger.LogInformation("Successful signout callback.");
        }
        else
        {
            _logger.LogError("Error validating signout callback: {error}", result.Error);
        }

        return(new EndSessionCallbackResult(result));
    }
Example #2
0
        private async Task <IEndpointResult> ProcessSignoutCallbackAsync(HttpContext context)
        {
            if (context.Request.Method != "GET")
            {
                _logger.LogWarning("Invalid HTTP method for end session callback endpoint.");
                return(new StatusCodeResult(HttpStatusCode.MethodNotAllowed));
            }

            _logger.LogDebug("Processing singout callback request");

            var parameters = context.Request.Query.AsNameValueCollection();
            var result     = await _endSessionRequestValidator.ValidateCallbackAsync(parameters);

            if (result.IsError == false)
            {
                _logger.LogInformation("Successful signout callback. Client logout iframe urls: {urls}", result.ClientLogoutUrls);
            }

            return(new EndSessionCallbackResult(result));
        }
Example #3
0
        public async Task <IEndpointResult> ProcessAsync(HttpContext context)
        {
            if (context.Request.Method != "GET")
            {
                _logger.LogWarning("Invalid HTTP method for end session callback endpoint.");
                return(new StatusCodeResult(HttpStatusCode.MethodNotAllowed));
            }

            _logger.LogDebug("Processing signout callback request");

            var parameters = context.Request.Query.AsNameValueCollection();
            var result     = await _endSessionRequestValidator.ValidateCallbackAsync(parameters);

            if (result.IsError == false)
            {
                _logger.LogInformation("Successful signout callback.");

                if (result.FrontChannelLogoutUrls?.Any() == true)
                {
                    _logger.LogDebug("Client front-channel iframe urls: {urls}", result.FrontChannelLogoutUrls);
                }
                else
                {
                    _logger.LogDebug("No client front-channel iframe urls");
                }

                if (result.BackChannelLogouts?.Any() == true)
                {
                    _logger.LogDebug("Client back-channel iframe urls: {urls}", result.BackChannelLogouts.Select(x => x.LogoutUri));
                }
                else
                {
                    _logger.LogDebug("No client back-channel iframe urls");
                }

                await InvokeBackChannelClientsAsync(result);
            }

            return(new EndSessionCallbackResult(result));
        }