Ensures that during install that we don't enable the identity user manager or cookie auth since no db tables exist, fixes the IsUpgrading check to check for actual valid tables
This commit is contained in:
@@ -203,11 +203,22 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the db is configured and there is a database context, but we are not 'configured' , then it means we are upgrading
|
||||
/// If the db is configured, there is a database context and there is an umbraco schema, but we are not 'configured' , then it means we are upgrading
|
||||
/// </summary>
|
||||
public bool IsUpgrading
|
||||
{
|
||||
get { return IsConfigured == false && DatabaseContext != null && DatabaseContext.IsDatabaseConfigured; }
|
||||
get
|
||||
{
|
||||
if (IsConfigured == false
|
||||
&& DatabaseContext != null
|
||||
&& DatabaseContext.IsDatabaseConfigured)
|
||||
{
|
||||
var schemaresult = DatabaseContext.ValidateDatabaseSchema();
|
||||
if (schemaresult.ValidTables.Count > 0) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -110,11 +110,15 @@ namespace Umbraco.Web.Security.Identity
|
||||
/// Ensures that the UmbracoBackOfficeAuthenticationMiddleware is assigned to the pipeline
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="appContext"></param>
|
||||
/// <returns></returns>
|
||||
public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app)
|
||||
public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, ApplicationContext appContext)
|
||||
{
|
||||
if (app == null) throw new ArgumentNullException("app");
|
||||
if (appContext == null) throw new ArgumentNullException("appContext");
|
||||
|
||||
//Don't proceed if the app is not ready
|
||||
if (appContext.IsUpgrading == false && appContext.IsConfigured == false) return app;
|
||||
|
||||
app.UseCookieAuthentication(new UmbracoBackOfficeCookieAuthOptions(
|
||||
UmbracoConfig.For.UmbracoSettings().Security,
|
||||
@@ -142,10 +146,15 @@ namespace Umbraco.Web.Security.Identity
|
||||
/// Umbraco back office configuration
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="appContext"></param>
|
||||
/// <returns></returns>
|
||||
public static IAppBuilder UseUmbracoBackOfficeExternalCookieAuthentication(this IAppBuilder app)
|
||||
public static IAppBuilder UseUmbracoBackOfficeExternalCookieAuthentication(this IAppBuilder app, ApplicationContext appContext)
|
||||
{
|
||||
if (app == null) throw new ArgumentNullException("app");
|
||||
if (appContext == null) throw new ArgumentNullException("appContext");
|
||||
|
||||
//Don't proceed if the app is not ready
|
||||
if (appContext.IsUpgrading == false && appContext.IsConfigured == false) return app;
|
||||
|
||||
app.UseCookieAuthentication(new CookieAuthenticationOptions
|
||||
{
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace Umbraco.Web
|
||||
//Ensure owin is configured for Umbraco back office authentication. If you have any front-end OWIN
|
||||
// cookie configuration, this must be declared after it.
|
||||
app
|
||||
.UseUmbracoBackOfficeCookieAuthentication()
|
||||
.UseUmbracoBackOfficeExternalCookieAuthentication();
|
||||
.UseUmbracoBackOfficeCookieAuthentication(ApplicationContext.Current)
|
||||
.UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext.Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user