/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/openiddict/openiddict-core for more information concerning * the license and the contributors participating to this project. */ using System; using System.Collections.Generic; using System.Security.Claims; using JetBrains.Annotations; namespace OpenIddict.Server { public static partial class OpenIddictServerEvents { /// /// Represents an event called for each request to the revocation endpoint to give the user code /// a chance to manually extract the revocation request from the ambient HTTP context. /// public class ExtractRevocationRequestContext : BaseValidatingContext { /// /// Creates a new instance of the class. /// public ExtractRevocationRequestContext([NotNull] OpenIddictServerTransaction transaction) : base(transaction) { } } /// /// Represents an event called for each request to the revocation endpoint /// to determine if the request is valid and should continue to be processed. /// public class ValidateRevocationRequestContext : BaseValidatingClientContext { /// /// Creates a new instance of the class. /// public ValidateRevocationRequestContext([NotNull] OpenIddictServerTransaction transaction) : base(transaction) { } /// /// Gets the optional token_type_hint parameter extracted from the /// revocation request, or null if it cannot be found. /// public string TokenTypeHint => Request.TokenTypeHint; /// /// Gets or sets the security principal extracted from the revoked token, if available. /// public ClaimsPrincipal Principal { get; set; } } /// /// Represents an event called for each validated revocation request /// to allow the user code to decide how the request should be handled. /// public class HandleRevocationRequestContext : BaseValidatingContext { /// /// Creates a new instance of the class. /// public HandleRevocationRequestContext([NotNull] OpenIddictServerTransaction transaction) : base(transaction) { } /// /// Gets or sets the security principal extracted from the revoked token. /// public ClaimsPrincipal Principal { get; set; } /// /// Gets the authentication ticket. /// public IDictionary Claims { get; } = new Dictionary(StringComparer.Ordinal); /// /// Gets or sets a boolean indicating whether /// the token was successfully revoked. /// public bool Revoked { get; set; } } /// /// Represents an event called before the revocation response is returned to the caller. /// public class ApplyRevocationResponseContext : BaseRequestContext { /// /// Creates a new instance of the class. /// public ApplyRevocationResponseContext([NotNull] OpenIddictServerTransaction transaction) : base(transaction) { } /// /// Gets the error code returned to the client application. /// When the response indicates a successful response, /// this property returns null. /// public string Error => Response.Error; } } }