/// <summary> /// Configure a custom UserStore with the Identity User Manager for Umbraco /// </summary> /// <param name="app"></param> /// <param name="runtimeState"></param> /// <param name="globalSettings"></param> /// <param name="userMembershipProvider"></param> /// <param name="customUserStore"></param> /// <param name="contentSettings"></param> public static void ConfigureUserManagerForUmbracoBackOffice(this IAppBuilder app, IRuntimeState runtimeState, IContentSection contentSettings, IGlobalSettings globalSettings, MembershipProviderBase userMembershipProvider, BackOfficeUserStore customUserStore) { if (runtimeState == null) { throw new ArgumentNullException(nameof(runtimeState)); } if (userMembershipProvider == null) { throw new ArgumentNullException(nameof(userMembershipProvider)); } if (customUserStore == null) { throw new ArgumentNullException(nameof(customUserStore)); } //Configure Umbraco user manager to be created per request app.CreatePerOwinContext <BackOfficeUserManager>( (options, owinContext) => BackOfficeUserManager.Create( options, customUserStore, userMembershipProvider, contentSettings)); app.SetBackOfficeUserManagerType <BackOfficeUserManager, BackOfficeIdentityUser>(); //Create a sign in manager per request app.CreatePerOwinContext <BackOfficeSignInManager>((options, context) => BackOfficeSignInManager.Create(options, context, globalSettings, app.CreateLogger(typeof(BackOfficeSignInManager).FullName))); }
/// <summary> /// Configure Default Identity User Manager for Umbraco /// </summary> /// <param name="app"></param> /// <param name="services"></param> /// <param name="contentSettings"></param> /// <param name="globalSettings"></param> /// <param name="userMembershipProvider"></param> public static void ConfigureUserManagerForUmbracoBackOffice(this IAppBuilder app, ServiceContext services, IContentSection contentSettings, IGlobalSettings globalSettings, MembershipProviderBase userMembershipProvider) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (userMembershipProvider == null) { throw new ArgumentNullException(nameof(userMembershipProvider)); } //Configure Umbraco user manager to be created per request app.CreatePerOwinContext <BackOfficeUserManager>( (options, owinContext) => BackOfficeUserManager.Create( options, services.UserService, services.MemberTypeService, services.EntityService, services.ExternalLoginService, userMembershipProvider, contentSettings, globalSettings)); app.SetBackOfficeUserManagerType <BackOfficeUserManager, BackOfficeIdentityUser>(); //Create a sign in manager per request app.CreatePerOwinContext <BackOfficeSignInManager>((options, context) => BackOfficeSignInManager.Create(options, context, globalSettings, app.CreateLogger <BackOfficeSignInManager>())); }