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.