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));
        }
Example #2
0
        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));
        }
Example #3
0
 /// <summary>
 /// Called before the authorization server starts emitting the revocation response to the response stream.
 /// If the web application wishes to produce the token status and metadata directly in this call, it may write to the
 /// context.Response directly and should call context.RequestCompleted to stop the default behavior from executing.
 /// </summary>
 /// <param name="context">The context of the event carries information in and results out.</param>
 /// <returns>Task to enable asynchronous execution</returns>
 public virtual Task ApplyRevocationResponse(ApplyRevocationResponseContext context) => OnApplyRevocationResponse(context);