diff --git a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs index b06148f6..993f8b60 100644 --- a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs +++ b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs @@ -428,7 +428,6 @@ using Microsoft.IdentityModel.Tokens; using OpenIddict.Client; using SmartFormat; using SmartFormat.Core.Settings; -using Properties = OpenIddict.Client.WebIntegration.OpenIddictClientWebIntegrationConstants.Properties; using static OpenIddict.Client.WebIntegration.OpenIddictClientWebIntegrationConstants; namespace OpenIddict.Client.WebIntegration; @@ -548,6 +547,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration var registration = new OpenIddictClientRegistration { ProviderName = Providers.{{ provider.name }}, + ProviderOptions = settings, Issuer = settings.Environment switch { @@ -647,11 +647,6 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration new SigningCredentials(settings.{{ setting.property_name }}, ""{{ setting.signing_algorithm }}""), {{~ end ~}} {{~ end ~}} - }, - - Properties = - { - [Properties.ProviderOptions] = settings } }; @@ -778,7 +773,6 @@ using OpenIddict.Client; using OpenIddict.Client.WebIntegration; using SmartFormat; using SmartFormat.Core.Settings; -using Properties = OpenIddict.Client.WebIntegration.OpenIddictClientWebIntegrationConstants.Properties; using static OpenIddict.Client.WebIntegration.OpenIddictClientWebIntegrationConstants; namespace OpenIddict.Client.WebIntegration; @@ -793,7 +787,7 @@ public static partial class OpenIddictClientWebIntegrationHelpers /// The {{ provider.name }} provider options. /// The provider options cannot be resolved. public static OpenIddictClientWebIntegrationOptions.{{ provider.name }} Get{{ provider.name }}Options(this OpenIddictClientRegistration registration) - => registration.GetProviderOptions() ?? + => registration.ProviderOptions is OpenIddictClientWebIntegrationOptions.{{ provider.name }} options ? options : throw new InvalidOperationException(SR.FormatID0333(Providers.{{ provider.name }})); {{~ end ~}} diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationConstants.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationConstants.cs index 440464fa..4c2b33f4 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationConstants.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationConstants.cs @@ -12,9 +12,4 @@ namespace OpenIddict.Client.WebIntegration; public static partial class OpenIddictClientWebIntegrationConstants { // Note: provider name constants are automatically generated by the source generator. - - public static class Properties - { - public const string ProviderOptions = ".provider_options"; - } } diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHelpers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHelpers.cs index 5335f935..7e783502 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHelpers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHelpers.cs @@ -4,8 +4,6 @@ * the license and the contributors participating to this project. */ -using Properties = OpenIddict.Client.WebIntegration.OpenIddictClientWebIntegrationConstants.Properties; - namespace OpenIddict.Client.WebIntegration; /// @@ -13,25 +11,5 @@ namespace OpenIddict.Client.WebIntegration; /// public static partial class OpenIddictClientWebIntegrationHelpers { - /// - /// Resolves the provider options associated with the client registration or - /// if no provider information is attached to the registration or if - /// the actual setting information doesn't match the specified . - /// - /// The type of the provider options. - /// The client registration. - /// The provider options, if applicable. - /// is null. - public static TOptions? GetProviderOptions(this OpenIddictClientRegistration registration) - { - if (registration is null) - { - throw new ArgumentNullException(nameof(registration)); - } - - return registration.Properties.TryGetValue(Properties.ProviderOptions, out var value) - && value is TOptions options ? options : default; - - // Note: provider-specific helpers are automatically generated by the source generator. - } + // Note: provider-specific helpers are automatically generated by the source generator. } diff --git a/src/OpenIddict.Client/OpenIddictClientRegistration.cs b/src/OpenIddict.Client/OpenIddictClientRegistration.cs index d9d364ae..e08a41dd 100644 --- a/src/OpenIddict.Client/OpenIddictClientRegistration.cs +++ b/src/OpenIddict.Client/OpenIddictClientRegistration.cs @@ -104,6 +104,11 @@ public sealed class OpenIddictClientRegistration /// public string? ProviderName { get; set; } + /// + /// Gets or sets the provider options, if applicable. + /// + public dynamic? ProviderOptions { get; set; } + /// /// Gets or sets the static server configuration, if applicable. ///