diff --git a/src/OpenIddict.Core/OpenIddictBuilder.cs b/src/OpenIddict.Core/OpenIddictBuilder.cs
index c33517a1..b2d17678 100644
--- a/src/OpenIddict.Core/OpenIddictBuilder.cs
+++ b/src/OpenIddict.Core/OpenIddictBuilder.cs
@@ -215,6 +215,38 @@ namespace Microsoft.AspNetCore.Builder {
return this;
}
+ ///
+ /// Adds a custom user manager.
+ ///
+ /// The type of the custom manager.
+ /// The .
+ public virtual OpenIddictBuilder AddUserManager() {
+ var contract = typeof(OpenIddictUserManager<>).MakeGenericType(UserType);
+ if (!contract.IsAssignableFrom(typeof(TManager))) {
+ throw new InvalidOperationException("Custom managers must be derived from OpenIddictUserManager.");
+ }
+
+ Services.AddScoped(contract, typeof(TManager));
+
+ return this;
+ }
+
+ ///
+ /// Adds a custom user store.
+ ///
+ /// The type of the custom store.
+ /// The .
+ public virtual OpenIddictBuilder AddUserStore() {
+ var contract = typeof(IOpenIddictTokenStore<>).MakeGenericType(UserType);
+ if (!contract.IsAssignableFrom(typeof(TStore))) {
+ throw new InvalidOperationException("Custom stores must implement IOpenIddictUserStore.");
+ }
+
+ Services.AddScoped(contract, typeof(TStore));
+
+ 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.