/* * 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.ComponentModel; using Microsoft.Extensions.Options; using OpenIddict.Client.SystemNetHttp; namespace OpenIddict.Client.WebIntegration; /// /// Contains the methods required to ensure that the OpenIddict client Web integration configuration is valid. /// [EditorBrowsable(EditorBrowsableState.Advanced)] public sealed partial class OpenIddictClientWebIntegrationConfiguration : IConfigureOptions, IPostConfigureOptions, IPostConfigureOptions { /// public void Configure(OpenIddictClientOptions options) { ArgumentNullException.ThrowIfNull(options); // Register the built-in event handlers used by the OpenIddict client Web components. options.Handlers.AddRange(OpenIddictClientWebIntegrationHandlers.DefaultHandlers); } /// public void PostConfigure(string? name, OpenIddictClientOptions options) { ArgumentNullException.ThrowIfNull(options); foreach (var registration in options.Registrations) { // If the client registration has a provider type attached, apply // the configuration logic corresponding to the specified provider. if (!string.IsNullOrEmpty(registration.ProviderType)) { ConfigureProvider(registration); } } } /// [Obsolete("This method is no longer supported and will be removed in a future version.")] public void PostConfigure(string? name, OpenIddictClientSystemNetHttpOptions options) => throw new NotSupportedException(SR.GetResourceString(SR.ID0403)); /// /// Amends the registration with the provider-specific configuration logic. /// /// The client registration. // Note: the implementation of this method is automatically generated by the source generator. [EditorBrowsable(EditorBrowsableState.Never)] public static partial void ConfigureProvider(OpenIddictClientRegistration registration); }