From 7b97de4912eb0c2f5d3a09b3d5a172fac63a4c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Tue, 17 Nov 2015 21:14:52 +0100 Subject: [PATCH] React to API changes in aspnet-contrib/AspNet.Security.OpenIdConnect.Server https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/commit/ebc22462aaf23ae1a0061cea5767e0d050e34829 https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/commit/65b1a9ab00afd0f1f8b466a9db7919f24f7a8cbf --- src/OpenIddict.Core/OpenIddictBuilder.cs | 12 ++---------- src/OpenIddict.Core/OpenIddictExtensions.cs | 10 +++++----- src/OpenIddict.Mvc/OpenIddictExtensions.cs | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/OpenIddict.Core/OpenIddictBuilder.cs b/src/OpenIddict.Core/OpenIddictBuilder.cs index 49a31ccf..02b3b543 100644 --- a/src/OpenIddict.Core/OpenIddictBuilder.cs +++ b/src/OpenIddict.Core/OpenIddictBuilder.cs @@ -5,12 +5,7 @@ namespace Microsoft.AspNet.Builder { /// /// Holds various properties allowing to configure OpenIddct. /// - public class OpenIddictBuilder : OpenIdConnectServerBuilder { - public OpenIddictBuilder(IApplicationBuilder builder) - : base(builder) { - Options = new OpenIddictOptions(); - } - + public class OpenIddictBuilder { /// /// Gets the list of the OpenIddict modules. /// @@ -19,9 +14,6 @@ namespace Microsoft.AspNet.Builder { /// /// Gets or sets the options used by OpenIddict. /// - public new OpenIddictOptions Options { - get { return base.Options as OpenIddictOptions; } - set { base.Options = value; } - } + public OpenIddictOptions Options { get; set; } = new OpenIddictOptions(); } } diff --git a/src/OpenIddict.Core/OpenIddictExtensions.cs b/src/OpenIddict.Core/OpenIddictExtensions.cs index 704a8064..a8de297b 100644 --- a/src/OpenIddict.Core/OpenIddictExtensions.cs +++ b/src/OpenIddict.Core/OpenIddictExtensions.cs @@ -62,7 +62,10 @@ namespace Microsoft.AspNet.Builder { public static IApplicationBuilder UseOpenIddictCore( [NotNull] this IApplicationBuilder app, [NotNull] Action configuration) { - var builder = new OpenIddictBuilder(app); + var builder = new OpenIddictBuilder(); + + // Resolve the OpenIddict provider from the services container. + builder.Options.Provider = app.ApplicationServices.GetRequiredService(); // By default, enable AllowInsecureHttp in development/testing environments. var environment = app.ApplicationServices.GetRequiredService(); @@ -78,10 +81,7 @@ namespace Microsoft.AspNet.Builder { })); // Add OpenIdConnectServerMiddleware to the ASP.NET 5 pipeline. - builder.AddModule(0, map => map.UseOpenIdConnectServer(options => { - options.Options = builder.Options; - options.Provider = app.ApplicationServices.GetRequiredService(); - })); + builder.AddModule(0, map => map.UseOpenIdConnectServer(builder.Options)); // Register the OpenIddict modules in the ASP.NET 5 pipeline. foreach (var module in builder.Modules.OrderBy(module => module.Position)) { diff --git a/src/OpenIddict.Mvc/OpenIddictExtensions.cs b/src/OpenIddict.Mvc/OpenIddictExtensions.cs index 0daf262d..506f797e 100644 --- a/src/OpenIddict.Mvc/OpenIddictExtensions.cs +++ b/src/OpenIddict.Mvc/OpenIddictExtensions.cs @@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Builder { }); } }), services => { - var registration = builder.Builder.ApplicationServices.GetRequiredService(); + var registration = app.ApplicationServices.GetRequiredService(); services.AddMvc() // Register the OpenIddict controller.