diff --git a/src/OpenIddict.Core/OpenIddictBuilder.cs b/src/OpenIddict.Core/OpenIddictBuilder.cs
index 586a64e5..7247834f 100644
--- a/src/OpenIddict.Core/OpenIddictBuilder.cs
+++ b/src/OpenIddict.Core/OpenIddictBuilder.cs
@@ -8,7 +8,6 @@ using System;
using System.ComponentModel;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
-using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using AspNet.Security.OpenIdConnect.Extensions;
@@ -206,34 +205,6 @@ namespace Microsoft.AspNetCore.Builder {
return this;
}
- ///
- /// Registers a new OpenIddict module. If a module with the same name already
- /// exists, the new instance is ignored and this extension has no effect.
- ///
- /// The name of the OpenIddict module.
- /// The relative position of the OpenIddict module in the ASP.NET Core pipeline.
- /// The delegate used to register the module in the ASP.NET Core pipeline.
- /// The.
- public virtual OpenIddictBuilder AddModule(
- [NotNull] string name, int position,
- [NotNull] Action registration) {
- if (string.IsNullOrEmpty(name)) {
- throw new ArgumentNullException(nameof(name));
- }
-
- if (registration == null) {
- throw new ArgumentNullException(nameof(registration));
- }
-
- return Configure(options => {
- if (options.Modules.Any(module => module.Name == name)) {
- return;
- }
-
- options.Modules.Add(new OpenIddictModule(name, position, registration));
- });
- }
-
///
/// Registers a new ephemeral key used to sign the tokens issued by OpenIddict: the key
/// is discarded when the application shuts down and tokens signed using this key are
diff --git a/src/OpenIddict.Core/OpenIddictExtensions.cs b/src/OpenIddict.Core/OpenIddictExtensions.cs
index 84cb24ea..184b7d30 100644
--- a/src/OpenIddict.Core/OpenIddictExtensions.cs
+++ b/src/OpenIddict.Core/OpenIddictExtensions.cs
@@ -5,7 +5,6 @@
*/
using System;
-using System.Linq;
using AspNet.Security.OpenIdConnect.Extensions;
using JetBrains.Annotations;
using Microsoft.Extensions.Caching.Distributed;
@@ -109,21 +108,7 @@ namespace Microsoft.AspNetCore.Builder {
"client credentials, password and refresh token flows.");
}
- // Get the modules registered by the application
- // and add the OpenID Connect server middleware.
- var modules = options.Modules.ToList();
- modules.Add(new OpenIddictModule("OpenID Connect server", 0, builder => builder.UseOpenIdConnectServer(options)));
-
- // Register the OpenIddict modules in the ASP.NET Core pipeline.
- foreach (var module in modules.OrderBy(module => module.Position)) {
- if (module?.Registration == null) {
- throw new InvalidOperationException("An invalid OpenIddict module was registered.");
- }
-
- module.Registration(app);
- }
-
- return app;
+ return app.UseOpenIdConnectServer(options);
}
///
diff --git a/src/OpenIddict.Core/OpenIddictModule.cs b/src/OpenIddict.Core/OpenIddictModule.cs
deleted file mode 100644
index 10993eec..00000000
--- a/src/OpenIddict.Core/OpenIddictModule.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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;
-using System.Diagnostics;
-using JetBrains.Annotations;
-using Microsoft.AspNetCore.Builder;
-
-namespace OpenIddict {
- ///
- /// Represents an OpenIddict module.
- ///
- [DebuggerDisplay("{Name,nq}")]
- public class OpenIddictModule {
- ///
- /// Initializes a new OpenIddict module.
- ///
- /// The name of the module.
- /// The position of the module in the ASP.NET Core pipeline.
- /// The delegate used to register the module in the pipeline.
- public OpenIddictModule(
- [NotNull] string name, int position,
- [NotNull] Action registration) {
- Name = name;
- Position = position;
- Registration = registration;
- }
-
- ///
- /// Initializes a new OpenIddict module.
- ///
- /// The delegate used to register the module in the pipeline.
- public OpenIddictModule([NotNull] Action registration) {
- Registration = registration;
- }
-
- ///
- /// Gets or sets the name of the module.
- ///
- public string Name { get; }
-
- ///
- /// Gets or sets the position of the module in the ASP.NET Core pipeline.
- ///
- public int Position { get; }
-
- ///
- /// Gets or sets the delegate used to register the
- /// OpenIddict module in the ASP.NET Core pipeline.
- ///
- public Action Registration { get; }
- }
-}
diff --git a/src/OpenIddict.Core/OpenIddictOptions.cs b/src/OpenIddict.Core/OpenIddictOptions.cs
index 3d156175..a89f054c 100644
--- a/src/OpenIddict.Core/OpenIddictOptions.cs
+++ b/src/OpenIddict.Core/OpenIddictOptions.cs
@@ -31,11 +31,6 @@ namespace OpenIddict {
///
public ICollection GrantTypes { get; } = new HashSet(StringComparer.Ordinal);
- ///
- /// Gets the list of the OpenIddict modules registered in the application.
- ///
- public ICollection Modules { get; } = new List();
-
///
/// Gets or sets a boolean determining whether client identification is required.
/// Enabling this option requires registering a client application and sending a