Browse Source

Remove the unnecessary ValidateTokenContext.AuthorizationId property

pull/1626/head
Kévin Chalet 3 years ago
parent
commit
0baa0e8399
  1. 5
      src/OpenIddict.Client/OpenIddictClientEvents.Protection.cs
  2. 1
      src/OpenIddict.Client/OpenIddictClientExtensions.cs
  3. 16
      src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs
  4. 2
      src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs

5
src/OpenIddict.Client/OpenIddictClientEvents.Protection.cs

@ -140,11 +140,6 @@ public static partial class OpenIddictClientEvents
/// </summary>
public bool IsReferenceToken { get; set; }
/// <summary>
/// Gets or sets the authorization entry identifier associated with the token, if applicable.
/// </summary>
public string? AuthorizationId { get; set; }
/// <summary>
/// Gets or sets the token entry identifier associated with the token, if applicable.
/// </summary>

1
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<RequireAuthorizationCodeValidated>();
builder.Services.TryAddSingleton<RequireAuthorizationIdResolved>();
builder.Services.TryAddSingleton<RequireBackchannelAccessTokenValidated>();
builder.Services.TryAddSingleton<RequireBackchannelIdentityTokenValidated>();
builder.Services.TryAddSingleton<RequireBackchannelIdentityTokenPrincipal>();

16
src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs

@ -27,22 +27,6 @@ public static class OpenIddictClientHandlerFilters
}
}
/// <summary>
/// Represents a filter that excludes the associated handlers if no authorization identifier is resolved from the token.
/// </summary>
public sealed class RequireAuthorizationIdResolved : IOpenIddictClientHandlerFilter<ValidateTokenContext>
{
public ValueTask<bool> IsActiveAsync(ValidateTokenContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
return new(!string.IsNullOrEmpty(context.AuthorizationId));
}
}
/// <summary>
/// Represents a filter that excludes the associated handlers if no backchannel access token is validated.
/// </summary>

2
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));
}

Loading…
Cancel
Save