Пример #1
0
        private async Task <bool> SendRevocationResponseAsync(OpenIdConnectResponse response)
        {
            var request = Context.GetOpenIdConnectRequest();

            Context.SetOpenIdConnectResponse(response);

            response.SetProperty(OpenIdConnectConstants.Properties.MessageType,
                                 OpenIdConnectConstants.MessageTypes.RevocationResponse);

            var notification = new ApplyRevocationResponseContext(Context, Options, request, response);
            await Options.Provider.ApplyRevocationResponse(notification);

            if (notification.HandledResponse)
            {
                Logger.LogDebug("The revocation request was handled in user code.");

                return(true);
            }

            else if (notification.Skipped)
            {
                Logger.LogDebug("The default revocation request handling was skipped from user code.");

                return(false);
            }

            Logger.LogInformation("The revocation response was successfully returned: {Response}.", response);

            return(await SendPayloadAsync(response));
        }
        private async Task <bool> SendRevocationResponseAsync(OpenIdConnectResponse response)
        {
            var request = Context.GetOpenIdConnectRequest();

            if (request == null)
            {
                request = new OpenIdConnectRequest();
            }

            Context.SetOpenIdConnectResponse(response);

            var notification = new ApplyRevocationResponseContext(Context, Options, request, response);
            await Options.Provider.ApplyRevocationResponse(notification);

            if (notification.HandledResponse)
            {
                return(true);
            }

            else if (notification.Skipped)
            {
                return(false);
            }

            return(await SendPayloadAsync(response));
        }
 /// <summary>
 /// Represents an event called before the revocation response is returned to the caller.
 /// </summary>
 /// <param name="context">The context instance associated with this event.</param>
 /// <returns>A <see cref="Task"/> that can be used to monitor the asynchronous operation.</returns>
 public virtual Task ApplyRevocationResponse(ApplyRevocationResponseContext context)
 => OnApplyRevocationResponse(context);