/* * 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.Security.Claims; namespace OpenIddict.Client; public static partial class OpenIddictClientEvents { /// /// Represents an event called for each request to the userinfo endpoint /// to give the user code a chance to add parameters to the userinfo request. /// public sealed class PrepareUserInfoRequestContext : BaseExternalContext { /// /// Creates a new instance of the class. /// public PrepareUserInfoRequestContext(OpenIddictClientTransaction transaction) : base(transaction) { } /// /// Gets or sets the request. /// public OpenIddictRequest Request { get => Transaction.Request!; set => Transaction.Request = value; } } /// /// Represents an event called for each request to the userinfo endpoint /// to send the userinfo request to the remote authorization server. /// public sealed class ApplyUserInfoRequestContext : BaseExternalContext { /// /// Creates a new instance of the class. /// public ApplyUserInfoRequestContext(OpenIddictClientTransaction transaction) : base(transaction) { } /// /// Gets or sets the request. /// public OpenIddictRequest Request { get => Transaction.Request!; set => Transaction.Request = value; } } /// /// Represents an event called for each userinfo response /// to extract the response parameters from the server response. /// public sealed class ExtractUserInfoResponseContext : BaseExternalContext { /// /// Creates a new instance of the class. /// public ExtractUserInfoResponseContext(OpenIddictClientTransaction transaction) : base(transaction) { } /// /// Gets or sets the request. /// public OpenIddictRequest Request { get => Transaction.Request!; set => Transaction.Request = value; } /// /// Gets or sets the response, or if it wasn't extracted yet. /// public OpenIddictResponse? Response { get => Transaction.Response; set => Transaction.Response = value; } /// /// Gets or sets the userinfo token, if available. /// public string? UserInfoToken { get; set; } } /// /// Represents an event called for each userinfo response. /// public sealed class HandleUserInfoResponseContext : BaseExternalContext { /// /// Creates a new instance of the class. /// public HandleUserInfoResponseContext(OpenIddictClientTransaction transaction) : base(transaction) { } /// /// Gets or sets the request. /// public OpenIddictRequest Request { get => Transaction.Request!; set => Transaction.Request = value; } /// /// Gets or sets the response. /// public OpenIddictResponse Response { get => Transaction.Response!; set => Transaction.Response = value; } /// /// Gets or sets the userinfo token, if available. /// public string? UserInfoToken { get; set; } /// /// Gets or sets the principal containing the claims resolved from the userinfo response. /// public ClaimsPrincipal? Principal { get; set; } } }