adds overload to specify custom backoffice user store for custom implementations (i.e. 2 factor auth, etc...)

This commit is contained in:
Shannon
2015-03-24 13:36:52 +11:00
parent b269760b21
commit 5a88ff774c
3 changed files with 69 additions and 6 deletions

View File

@@ -17,8 +17,9 @@ namespace Umbraco.Web.Security.Identity
public static class AppBuilderExtensions
{
#region Backoffice
/// <summary>
/// Configure Identity User Manager for Umbraco
/// Configure Default Identity User Manager for Umbraco
/// </summary>
/// <param name="app"></param>
/// <param name="appContext"></param>
@@ -36,12 +37,36 @@ namespace Umbraco.Web.Security.Identity
app.CreatePerOwinContext<BackOfficeUserManager>(
(options, owinContext) => BackOfficeUserManager.Create(
options,
owinContext,
appContext.Services.UserService,
appContext.Services.ExternalLoginService,
userMembershipProvider));
}
/// <summary>
/// Configure a custom UserStore with the Identity User Manager for Umbraco
/// </summary>
/// <param name="app"></param>
/// <param name="appContext"></param>
/// <param name="userMembershipProvider"></param>
/// <param name="customUserStore"></param>
public static void ConfigureUserManagerForUmbracoBackOffice(this IAppBuilder app,
ApplicationContext appContext,
MembershipProviderBase userMembershipProvider,
BackOfficeUserStore customUserStore)
{
//Don't proceed if the app is not ready
if (appContext.IsConfigured == false
|| appContext.DatabaseContext == null
|| appContext.DatabaseContext.IsDatabaseConfigured == false) return;
//Configure Umbraco user manager to be created per request
app.CreatePerOwinContext<BackOfficeUserManager>(
(options, owinContext) => BackOfficeUserManager.Create(
options,
customUserStore,
userMembershipProvider));
}
/// <summary>
/// Ensures that the UmbracoBackOfficeAuthenticationMiddleware is assigned to the pipeline
/// </summary>