diff --git a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
index 6f5ec274..fbf9ca4f 100644
--- a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
+++ b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
@@ -72,26 +72,47 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
{
{{~ for provider in providers ~}}
///
- /// Enables the {{ provider.display_name }} integration and registers the associated services in the DI container.
+ /// Adds a new {{ provider.display_name }} client registration.
{{~ if provider.documentation ~}}
/// For more information, read the documentation.
{{~ end ~}}
///
- /// This extension can be safely called multiple times.
- /// The instance.
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete($""This method was replaced by {nameof(Add{{ provider.name }})} and will be removed in a future version."")]
- public OpenIddictClientWebIntegrationBuilder.{{ provider.name }} Use{{ provider.name }}()
- => Add{{ provider.name }}();
+ /// The delegate used to configure the OpenIddict/{{ provider.display_name }} options.
+ /// The instance.
+ public OpenIddictClientWebIntegrationBuilder Add{{ provider.name }}(Action configuration)
+ {
+ if (configuration is null)
+ {
+ throw new ArgumentNullException(nameof(configuration));
+ }
+
+ Services.Configure(options =>
+ {
+ var registration = new OpenIddictClientRegistration
+ {
+ ProviderSettings = new OpenIddictClientWebIntegrationSettings.{{ provider.name }}(),
+ ProviderType = ProviderTypes.{{ provider.name }}
+ };
+
+ configuration(new OpenIddictClientWebIntegrationBuilder.{{ provider.name }}(registration));
+
+ options.Registrations.Add(registration);
+ });
+
+ return this;
+ }
///
- /// Adds a new {{ provider.display_name }} client registration.
+ /// Enables the {{ provider.display_name }} integration and registers the associated services in the DI container.
{{~ if provider.documentation ~}}
/// For more information, read the documentation.
{{~ end ~}}
///
+ /// This extension can be safely called multiple times.
/// The instance.
- public OpenIddictClientWebIntegrationBuilder.{{ provider.name }} Add{{ provider.name }}()
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete($""This method was replaced by {nameof(Add{{ provider.name }})} and will be removed in a future version."")]
+ public OpenIddictClientWebIntegrationBuilder.{{ provider.name }} Use{{ provider.name }}()
{
var registration = new OpenIddictClientRegistration
{
@@ -117,26 +138,6 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
[Obsolete($""This method was replaced by {nameof(Add{{ provider.name }})} and will be removed in a future version."")]
public OpenIddictClientWebIntegrationBuilder Use{{ provider.name }}(Action configuration)
=> Add{{ provider.name }}(configuration);
-
- ///
- /// Adds a new {{ provider.display_name }} client registration.
- {{~ if provider.documentation ~}}
- /// For more information, read the documentation.
- {{~ end ~}}
- ///
- /// The delegate used to configure the OpenIddict/{{ provider.display_name }} options.
- /// The instance.
- public OpenIddictClientWebIntegrationBuilder Add{{ provider.name }}(Action configuration)
- {
- if (configuration is null)
- {
- throw new ArgumentNullException(nameof(configuration));
- }
-
- configuration(Add{{ provider.name }}());
-
- return this;
- }
{{~ end ~}}
{{~ for provider in providers ~}}
diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs
index a643df64..a0c253ce 100644
--- a/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs
+++ b/sandbox/OpenIddict.Sandbox.AspNet.Server/Startup.cs
@@ -71,10 +71,12 @@ namespace OpenIddict.Sandbox.AspNet.Server
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
- .AddGitHub()
- .SetClientId("c4ade52327b01ddacff3")
- .SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
- .SetRedirectUri("callback/login/github");
+ .AddGitHub(options =>
+ {
+ options.SetClientId("c4ade52327b01ddacff3")
+ .SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
+ .SetRedirectUri("callback/login/github");
+ });
})
// Register the OpenIddict server components.
diff --git a/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs b/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs
index 35590055..be27cb5c 100644
--- a/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs
+++ b/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs
@@ -89,10 +89,12 @@ public class Startup
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
- .AddGitHub()
- .SetClientId("c4ade52327b01ddacff3")
- .SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
- .SetRedirectUri("callback/login/github");
+ .AddGitHub(options =>
+ {
+ options.SetClientId("c4ade52327b01ddacff3")
+ .SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
+ .SetRedirectUri("callback/login/github");
+ });
})
// Register the OpenIddict server components.
diff --git a/sandbox/OpenIddict.Sandbox.WinForms.Client/Program.cs b/sandbox/OpenIddict.Sandbox.WinForms.Client/Program.cs
index 530145a6..93a0e85e 100644
--- a/sandbox/OpenIddict.Sandbox.WinForms.Client/Program.cs
+++ b/sandbox/OpenIddict.Sandbox.WinForms.Client/Program.cs
@@ -81,11 +81,13 @@ var host = new HostBuilder()
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
- .AddGitHub()
- .SetClientId("cf8efb4d76c0cb7109d3")
- .SetClientSecret("e8c0f6b869164411bb9052e42414cbcc52d518cd")
- // Note: GitHub doesn't support the recommended ":/" syntax and requires using "://".
- .SetRedirectUri("com.openiddict.sandbox.winforms.client://callback/login/github");
+ .AddGitHub(options =>
+ {
+ options.SetClientId("cf8efb4d76c0cb7109d3")
+ .SetClientSecret("e8c0f6b869164411bb9052e42414cbcc52d518cd")
+ // Note: GitHub doesn't support the recommended ":/" syntax and requires using "://".
+ .SetRedirectUri("com.openiddict.sandbox.winforms.client://callback/login/github");
+ });
});
// Register the worker responsible for creating the database used to store tokens
diff --git a/sandbox/OpenIddict.Sandbox.Wpf.Client/Program.cs b/sandbox/OpenIddict.Sandbox.Wpf.Client/Program.cs
index cbe5a28c..f6bde6eb 100644
--- a/sandbox/OpenIddict.Sandbox.Wpf.Client/Program.cs
+++ b/sandbox/OpenIddict.Sandbox.Wpf.Client/Program.cs
@@ -82,11 +82,13 @@ var host = new HostBuilder()
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
- .AddGitHub()
- .SetClientId("8abc54b6d5f4e39d78aa")
- .SetClientSecret("f37ef38bdb18a0f5f2d430a8edbed4353c012dc3")
- // Note: GitHub doesn't support the recommended ":/" syntax and requires using "://".
- .SetRedirectUri("com.openiddict.sandbox.wpf.client://callback/login/github");
+ .AddGitHub(options =>
+ {
+ options.SetClientId("8abc54b6d5f4e39d78aa")
+ .SetClientSecret("f37ef38bdb18a0f5f2d430a8edbed4353c012dc3")
+ // Note: GitHub doesn't support the recommended ":/" syntax and requires using "://".
+ .SetRedirectUri("com.openiddict.sandbox.wpf.client://callback/login/github");
+ });
});
// Register the worker responsible for creating the database used to store tokens