From 0baa0e8399738b578bbde6874977f05c3bd7e50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Mon, 12 Dec 2022 23:30:58 +0100 Subject: [PATCH] Remove the unnecessary ValidateTokenContext.AuthorizationId property --- .../OpenIddictClientEvents.Protection.cs | 5 ----- .../OpenIddictClientExtensions.cs | 1 - .../OpenIddictClientHandlerFilters.cs | 16 ---------------- .../OpenIddictClientHandlers.Protection.cs | 2 -- 4 files changed, 24 deletions(-) diff --git a/src/OpenIddict.Client/OpenIddictClientEvents.Protection.cs b/src/OpenIddict.Client/OpenIddictClientEvents.Protection.cs index 9754af17..4b116219 100644 --- a/src/OpenIddict.Client/OpenIddictClientEvents.Protection.cs +++ b/src/OpenIddict.Client/OpenIddictClientEvents.Protection.cs @@ -140,11 +140,6 @@ public static partial class OpenIddictClientEvents /// public bool IsReferenceToken { get; set; } - /// - /// Gets or sets the authorization entry identifier associated with the token, if applicable. - /// - public string? AuthorizationId { get; set; } - /// /// Gets or sets the token entry identifier associated with the token, if applicable. /// diff --git a/src/OpenIddict.Client/OpenIddictClientExtensions.cs b/src/OpenIddict.Client/OpenIddictClientExtensions.cs index 348e4e08..8b317b93 100644 --- a/src/OpenIddict.Client/OpenIddictClientExtensions.cs +++ b/src/OpenIddict.Client/OpenIddictClientExtensions.cs @@ -37,7 +37,6 @@ public static class OpenIddictClientExtensions // Register the built-in filters used by the default OpenIddict client event handlers. builder.Services.TryAddSingleton(); - builder.Services.TryAddSingleton(); builder.Services.TryAddSingleton(); builder.Services.TryAddSingleton(); builder.Services.TryAddSingleton(); diff --git a/src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs b/src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs index 0a1825f6..d8e907e4 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs @@ -27,22 +27,6 @@ public static class OpenIddictClientHandlerFilters } } - /// - /// Represents a filter that excludes the associated handlers if no authorization identifier is resolved from the token. - /// - public sealed class RequireAuthorizationIdResolved : IOpenIddictClientHandlerFilter - { - public ValueTask IsActiveAsync(ValidateTokenContext context) - { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - return new(!string.IsNullOrEmpty(context.AuthorizationId)); - } - } - /// /// Represents a filter that excludes the associated handlers if no backchannel access token is validated. /// diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs index 35d9ef66..6ab4839e 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs @@ -8,7 +8,6 @@ using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Security.Claims; -using System.Security.Cryptography; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.JsonWebTokens; using Microsoft.IdentityModel.Tokens; @@ -474,7 +473,6 @@ public static partial class OpenIddictClientHandlers context.Principal .SetCreationDate(await _tokenManager.GetCreationDateAsync(token)) .SetExpirationDate(await _tokenManager.GetExpirationDateAsync(token)) - .SetAuthorizationId(context.AuthorizationId = await _tokenManager.GetAuthorizationIdAsync(token)) .SetTokenId(context.TokenId = await _tokenManager.GetIdAsync(token)) .SetTokenType(await _tokenManager.GetTypeAsync(token)); }