Browse Source

Remove the members that were obsoleted in OpenIddict 5.x

pull/2183/head
Kévin Chalet 2 years ago
parent
commit
dbcd6d1ad7
  1. 11
      src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs
  2. 3
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs
  3. 29
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlerFilters.cs
  4. 85
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs
  5. 13
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHelpers.cs
  6. 3
      src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpExtensions.cs
  7. 20
      src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlerFilters.cs
  8. 44
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs
  9. 8
      src/OpenIddict.Client/OpenIddictClientConfiguration.cs
  10. 18
      src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs
  11. 6
      src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs
  12. 6
      src/OpenIddict.Server/OpenIddictServerConfiguration.cs
  13. 3
      src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs
  14. 26
      src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs
  15. 3
      src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs
  16. 20
      src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlerFilters.cs
  17. 8
      src/OpenIddict.Validation/OpenIddictValidationConfiguration.cs

11
src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs

@ -81,15 +81,4 @@ public class OpenIddictApplicationDescriptor
/// Gets the settings associated with the application.
/// </summary>
public Dictionary<string, string> Settings { get; } = new(StringComparer.Ordinal);
/// <summary>
/// Gets or sets the client type associated with the application.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete($"This property was replaced by {nameof(ClientType)} and will be removed in a future version.", true)]
public string? Type
{
get => ClientType;
set => ClientType = value;
}
}

3
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs

@ -112,9 +112,6 @@ public static class OpenIddictClientSystemIntegrationExtensions
builder.Services.TryAddSingleton<RequireProtocolActivation>();
builder.Services.TryAddSingleton<RequireSystemBrowser>();
builder.Services.TryAddSingleton<RequireWebAuthenticationBroker>();
#pragma warning disable CS0618
builder.Services.TryAddSingleton<RequireWebAuthenticationResult>();
#pragma warning restore CS0618
// Register the built-in event handlers used by the OpenIddict client system integration components.
// Note: the order used here is not important, as the actual order is set in the options.

29
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlerFilters.cs

@ -258,35 +258,6 @@ public static class OpenIddictClientSystemIntegrationHandlerFilters
return new(mode is WebAuthenticationBroker);
}
#endif
return new(false);
}
}
/// <summary>
/// Represents a filter that excludes the associated handlers if no
/// web authentication operation was triggered during the transaction.
/// </summary>
[Obsolete("This filter is obsolete and will be removed in a future version.")]
public sealed class RequireWebAuthenticationResult : IOpenIddictClientHandlerFilter<BaseContext>
{
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
#if SUPPORTS_WINDOWS_RUNTIME
if (IsWebAuthenticationBrokerSupported())
{
return new(ContainsWebAuthenticationResult(context.Transaction));
}
[MethodImpl(MethodImplOptions.NoInlining)]
static bool ContainsWebAuthenticationResult(OpenIddictClientTransaction transaction)
=> transaction.GetWebAuthenticationResult() is not null;
#endif
return new(false);
}

85
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs

@ -237,29 +237,6 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
}
}
/// <summary>
/// Contains the logic responsible for resolving the request URI from the web authentication result.
/// Note: this handler is not used when the OpenID Connect request is not a web authentication result.
/// </summary>
[Obsolete("This event handler is obsolete and will be removed in a future version.")]
public sealed class ResolveRequestUriFromWebAuthenticationResult : IOpenIddictClientHandler<ProcessRequestContext>
{
/// <summary>
/// Gets the default descriptor definition assigned to this handler.
/// </summary>
public static OpenIddictClientHandlerDescriptor Descriptor { get; }
= OpenIddictClientHandlerDescriptor.CreateBuilder<ProcessRequestContext>()
.AddFilter<RequireWebAuthenticationResult>()
.UseSingletonHandler<ResolveRequestUriFromWebAuthenticationResult>()
.SetOrder(ResolveRequestUriFromPlatformCallback.Descriptor.Order + 1_000)
.SetType(OpenIddictClientHandlerType.BuiltIn)
.Build();
/// <inheritdoc/>
public ValueTask HandleAsync(ProcessRequestContext context)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
}
/// <summary>
/// Contains the logic responsible for inferring the endpoint type from the request URI, ignoring
/// the port when comparing the request URI with the endpoint URIs configured in the options.
@ -620,30 +597,6 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
}
}
/// <summary>
/// Contains the logic responsible for extracting OpenID Connect
/// requests from the response data of a web authentication result.
/// Note: this handler is not used when the OpenID Connect request is not a web authentication result.
/// </summary>
[Obsolete("This event handler is obsolete and will be removed in a future version.")]
public sealed class ExtractWebAuthenticationResultData<TContext> : IOpenIddictClientHandler<TContext> where TContext : BaseValidatingContext
{
/// <summary>
/// Gets the default descriptor definition assigned to this handler.
/// </summary>
public static OpenIddictClientHandlerDescriptor Descriptor { get; }
= OpenIddictClientHandlerDescriptor.CreateBuilder<TContext>()
.AddFilter<RequireWebAuthenticationResult>()
.UseSingletonHandler<ExtractWebAuthenticationResultData<TContext>>()
.SetOrder(ExtractPlatformCallbackParameters<TContext>.Descriptor.Order + 1_000)
.SetType(OpenIddictClientHandlerType.BuiltIn)
.Build();
/// <inheritdoc/>
public ValueTask HandleAsync(TContext context)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
}
/// <summary>
/// Contains the logic responsible for waiting for the marshalled authentication operation to complete, if applicable.
/// </summary>
@ -2446,42 +2399,4 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
return default;
}
}
/// <summary>
/// Contains the logic responsible for marking OpenID Connect
/// responses returned via web authentication results as processed.
/// </summary>
[Obsolete("This handler is obsolete and will be removed in a future version.")]
public sealed class ProcessWebAuthenticationResultResponse<TContext> : IOpenIddictClientHandler<TContext>
where TContext : BaseRequestContext
{
/// <summary>
/// Gets the default descriptor definition assigned to this handler.
/// </summary>
public static OpenIddictClientHandlerDescriptor Descriptor { get; }
= OpenIddictClientHandlerDescriptor.CreateBuilder<TContext>()
.AddFilter<RequireWebAuthenticationResult>()
.UseSingletonHandler<ProcessWebAuthenticationResultResponse<TContext>>()
.SetOrder(int.MaxValue)
.SetType(OpenIddictClientHandlerType.BuiltIn)
.Build();
/// <inheritdoc/>
public ValueTask HandleAsync(TContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
// For both protocol activations (initial or redirected) and web-view-like results,
// no proper response can be generated and eventually displayed to the user. In this
// case, simply stop processing the response and mark the request as fully handled.
//
// Note: this logic applies to both successful and errored responses.
context.HandleRequest();
return default;
}
}
}

13
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHelpers.cs

@ -68,19 +68,6 @@ public static class OpenIddictClientSystemIntegrationHelpers
public static HttpListenerContext? GetHttpListenerContext(this OpenIddictClientTransaction transaction)
=> transaction.GetProperty<HttpListenerContext>(typeof(HttpListenerContext).FullName!);
#if SUPPORTS_WINDOWS_RUNTIME
/// <summary>
/// Gets the <see cref="WebAuthenticationResult"/> associated with the current context.
/// </summary>
/// <param name="transaction">The transaction instance.</param>
/// <returns>The <see cref="HttpListenerContext"/> instance or <see langword="null"/> if it couldn't be found.</returns>
[Obsolete("This extension is obsolete and will be removed in a future version."), SupportedOSPlatform("windows10.0.17763")]
public static WebAuthenticationResult? GetWebAuthenticationResult(this OpenIddictClientTransaction transaction)
=> transaction.GetPlatformCallback() is OpenIddictClientSystemIntegrationPlatformCallback callback &&
callback.Properties.TryGetValue(typeof(WebAuthenticationResult).FullName!, out object? property) &&
property is WebAuthenticationResult result ? result : null;
#endif
/// <summary>
/// Determines whether the current Windows version
/// is greater than or equals to the specified version.

3
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpExtensions.cs

@ -37,9 +37,6 @@ public static class OpenIddictClientSystemNetHttpExtensions
builder.Services.TryAdd(OpenIddictClientSystemNetHttpHandlers.DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor));
// Register the built-in filters used by the default OpenIddict System.Net.Http event handlers.
#pragma warning disable CS0618
builder.Services.TryAddSingleton<RequireHttpMetadataUri>();
#pragma warning restore CS0618
builder.Services.TryAddSingleton<RequireHttpUri>();
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.

20
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlerFilters.cs

@ -11,26 +11,6 @@ namespace OpenIddict.Client.SystemNetHttp;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class OpenIddictClientSystemNetHttpHandlerFilters
{
/// <summary>
/// Represents a filter that excludes the associated handlers if the URI is not an HTTP or HTTPS address.
/// </summary>
[Obsolete("This filter is obsolete and will be removed in a future version.")]
public sealed class RequireHttpMetadataUri : IOpenIddictClientHandlerFilter<BaseExternalContext>
{
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseExternalContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
return new(
string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) ||
string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase));
}
}
/// <summary>
/// Represents a filter that excludes the associated handlers if the URI is not an HTTP or HTTPS address.
/// </summary>

44
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs

@ -259,50 +259,6 @@ public static partial class OpenIddictClientWebIntegrationHandlers
}
}
/// <summary>
/// Contains the logic responsible for amending the client authentication methods
/// supported by the device authorization endpoint for the providers that require it.
/// </summary>
[Obsolete("This event handler is obsolete and will be removed in a future version.", error: true)]
public sealed class AmendDeviceAuthorizationEndpointClientAuthenticationMethods : IOpenIddictClientHandler<HandleConfigurationResponseContext>
{
/// <summary>
/// Gets the default descriptor definition assigned to this handler.
/// </summary>
public static OpenIddictClientHandlerDescriptor Descriptor { get; }
= OpenIddictClientHandlerDescriptor.CreateBuilder<HandleConfigurationResponseContext>()
.UseSingletonHandler<AmendDeviceAuthorizationEndpointClientAuthenticationMethods>()
.SetOrder(ExtractTokenEndpointClientAuthenticationMethods.Descriptor.Order + 500)
.SetType(OpenIddictClientHandlerType.BuiltIn)
.Build();
/// <inheritdoc/>
public ValueTask HandleAsync(HandleConfigurationResponseContext context)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
}
/// <summary>
/// Contains the logic responsible for amending the client authentication
/// methods supported by the token endpoint for the providers that require it.
/// </summary>
[Obsolete("This event handler is obsolete and will be removed in a future version.", error: true)]
public sealed class AmendTokenEndpointClientAuthenticationMethods : IOpenIddictClientHandler<HandleConfigurationResponseContext>
{
/// <summary>
/// Gets the default descriptor definition assigned to this handler.
/// </summary>
public static OpenIddictClientHandlerDescriptor Descriptor { get; }
= OpenIddictClientHandlerDescriptor.CreateBuilder<HandleConfigurationResponseContext>()
.UseSingletonHandler<AmendTokenEndpointClientAuthenticationMethods>()
.SetOrder(AmendDeviceAuthorizationEndpointClientAuthenticationMethods.Descriptor.Order + 500)
.SetType(OpenIddictClientHandlerType.BuiltIn)
.Build();
/// <inheritdoc/>
public ValueTask HandleAsync(HandleConfigurationResponseContext context)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
}
/// <summary>
/// Contains the logic responsible for amending the supported client
/// authentication methods for the providers that require it.

8
src/OpenIddict.Client/OpenIddictClientConfiguration.cs

@ -27,14 +27,6 @@ public sealed class OpenIddictClientConfiguration : IPostConfigureOptions<OpenId
private readonly OpenIddictClientService _service;
private readonly IServiceProvider _provider;
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictClientConfiguration"/> class.
/// </summary>
/// <param name="service">The OpenIddict client service.</param>
[Obsolete("This constructor is no longer supported and will be removed in a future version.", error: true)]
public OpenIddictClientConfiguration(OpenIddictClientService service)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictClientConfiguration"/> class.
/// </summary>

18
src/OpenIddict.Client/OpenIddictClientHandlerFilters.cs

@ -629,24 +629,10 @@ public static class OpenIddictClientHandlerFilters
/// <summary>
/// Represents a filter that excludes the associated handlers if the WS-Federation claim mapping feature was disabled.
/// </summary>
public sealed class RequireWebServicesFederationClaimMappingEnabled :
IOpenIddictClientHandlerFilter<ProcessAuthenticationContext>,
IOpenIddictClientHandlerFilter<BaseContext>
public sealed class RequireWebServicesFederationClaimMappingEnabled : IOpenIddictClientHandlerFilter<BaseContext>
{
/// <inheritdoc/>
[Obsolete("This method is obsolete and will be removed in a future version.")]
public ValueTask<bool> IsActiveAsync(ProcessAuthenticationContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
return new(!context.Options.DisableWebServicesFederationClaimMapping);
}
/// <inheritdoc/>
ValueTask<bool> IOpenIddictClientHandlerFilter<BaseContext>.IsActiveAsync(BaseContext context)
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{

6
src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs

@ -18,12 +18,6 @@ public sealed class OpenIddictQuartzConfiguration : IConfigureOptions<QuartzOpti
{
private readonly IServiceProvider _provider;
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictQuartzConfiguration"/> class.
/// </summary>
[Obsolete("This constructor is no longer supported and will be removed in a future version.", error: true)]
public OpenIddictQuartzConfiguration() => throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictQuartzConfiguration"/> class.
/// </summary>

6
src/OpenIddict.Server/OpenIddictServerConfiguration.cs

@ -24,12 +24,6 @@ public sealed class OpenIddictServerConfiguration : IPostConfigureOptions<OpenId
{
private readonly IServiceProvider _provider;
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictServerConfiguration"/> class.
/// </summary>
[Obsolete("This constructor is no longer supported and will be removed in a future version.", error: true)]
public OpenIddictServerConfiguration() => throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictServerConfiguration"/> class.
/// </summary>

3
src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs

@ -1068,9 +1068,6 @@ public static partial class OpenIddictServerHandlers
{
private readonly IOpenIddictApplicationManager? _applicationManager;
[Obsolete("This constructor is no longer supported and will be removed in a future version.", error: true)]
public ValidateResponseType() => throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
public ValidateResponseType(IOpenIddictApplicationManager? applicationManager = null)
=> _applicationManager = applicationManager;

26
src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs

@ -1557,31 +1557,5 @@ public static partial class OpenIddictServerHandlers
}
}
}
/// <summary>
/// Contains the logic responsible for beautifying user-typed tokens.
/// Note: this handler is not used when the degraded mode is enabled.
/// </summary>
[Obsolete("This event handler is obsolete and will be removed in a future version.", error: true)]
public sealed class BeautifyToken : IOpenIddictServerHandler<GenerateTokenContext>
{
/// <summary>
/// Gets the default descriptor definition assigned to this handler.
/// </summary>
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<GenerateTokenContext>()
// Technically, this handler doesn't require that the degraded mode be disabled
// but the default CreateReferenceEntry handler that creates the user code
// reference identifiers only works when the degraded mode is disabled.
.AddFilter<RequireDegradedModeDisabled>()
.UseSingletonHandler<BeautifyToken>()
.SetOrder(AttachTokenPayload.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
.Build();
/// <inheritdoc/>
public ValueTask HandleAsync(GenerateTokenContext context)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
}
}
}

3
src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpExtensions.cs

@ -37,9 +37,6 @@ public static class OpenIddictValidationSystemNetHttpExtensions
builder.Services.TryAdd(OpenIddictValidationSystemNetHttpHandlers.DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor));
// Register the built-in filters used by the default OpenIddict System.Net.Http event handlers.
#pragma warning disable CS0618
builder.Services.TryAddSingleton<RequireHttpMetadataUri>();
#pragma warning restore CS0618
builder.Services.TryAddSingleton<RequireHttpUri>();
// Note: TryAddEnumerable() is used here to ensure the initializers are registered only once.

20
src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlerFilters.cs

@ -11,26 +11,6 @@ namespace OpenIddict.Validation.SystemNetHttp;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static class OpenIddictValidationSystemNetHttpHandlerFilters
{
/// <summary>
/// Represents a filter that excludes the associated handlers if the URI is not an HTTP or HTTPS address.
/// </summary>
[Obsolete("This filter is obsolete and will be removed in a future version.")]
public sealed class RequireHttpMetadataUri : IOpenIddictValidationHandlerFilter<BaseExternalContext>
{
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseExternalContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
return new(
string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) ||
string.Equals(context.RemoteUri?.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase));
}
}
/// <summary>
/// Represents a filter that excludes the associated handlers if the URI is not an HTTP or HTTPS address.
/// </summary>

8
src/OpenIddict.Validation/OpenIddictValidationConfiguration.cs

@ -20,14 +20,6 @@ public sealed class OpenIddictValidationConfiguration : IPostConfigureOptions<Op
private readonly OpenIddictValidationService _service;
private readonly IServiceProvider _provider;
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictValidationConfiguration"/> class.
/// </summary>
/// <param name="service">The validation service.</param>
[Obsolete("This constructor is no longer supported and will be removed in a future version.", error: true)]
public OpenIddictValidationConfiguration(OpenIddictValidationService service)
=> throw new NotSupportedException(SR.GetResourceString(SR.ID0403));
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictValidationConfiguration"/> class.
/// </summary>

Loading…
Cancel
Save