Skip to content

Commit

Permalink
Fixes: U4-7467 Umbraco 7.3.2 Clean install, OWIN error after database…
Browse files Browse the repository at this point in the history
… creation and bumps version
  • Loading branch information
Shazwazza committed Nov 27, 2015
1 parent eae74b0 commit 87100fe
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

[assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyFileVersion("7.3.1")]
[assembly: AssemblyInformationalVersion("7.3.1")]
[assembly: AssemblyFileVersion("7.3.3")]
[assembly: AssemblyInformationalVersion("7.3.3")]
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2413,7 +2413,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7310</DevelopmentServerPort>
<DevelopmentServerPort>7330</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7330</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
Expand Down
52 changes: 23 additions & 29 deletions src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ public static void ConfigureUserManagerForUmbracoBackOffice(this IAppBuilder app
if (appContext == null) throw new ArgumentNullException("appContext");
if (userMembershipProvider == null) throw new ArgumentNullException("userMembershipProvider");

//Don't proceed if the app is not ready
if (appContext.IsUpgrading == false && appContext.IsConfigured == false) return;

//Configure Umbraco user manager to be created per request
app.CreatePerOwinContext<BackOfficeUserManager>(
(options, owinContext) => BackOfficeUserManager.Create(
Expand Down Expand Up @@ -78,9 +75,6 @@ public static void ConfigureUserManagerForUmbracoBackOffice(this IAppBuilder app
if (userMembershipProvider == null) throw new ArgumentNullException("userMembershipProvider");
if (customUserStore == null) throw new ArgumentNullException("customUserStore");

//Don't proceed if the app is not ready
if (appContext.IsUpgrading == false && appContext.IsConfigured == false) return;

//Configure Umbraco user manager to be created per request
app.CreatePerOwinContext<BackOfficeUserManager>(
(options, owinContext) => BackOfficeUserManager.Create(
Expand All @@ -107,9 +101,6 @@ public static void ConfigureUserManagerForUmbracoBackOffice<TManager, TUser>(thi
if (appContext == null) throw new ArgumentNullException("appContext");
if (userManager == null) throw new ArgumentNullException("userManager");

//Don't proceed if the app is not ready
if (appContext.IsUpgrading == false && appContext.IsConfigured == false) return;

//Configure Umbraco user manager to be created per request
app.CreatePerOwinContext<TManager>(userManager);

Expand All @@ -127,10 +118,7 @@ public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuil
{
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;


var authOptions = new UmbracoBackOfficeCookieAuthOptions(
UmbracoConfig.For.UmbracoSettings().Security,
GlobalSettings.TimeOutInMinutes,
Expand All @@ -148,19 +136,23 @@ public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuil
identity => identity.GetUserId<int>()),
}
};

app.UseUmbracoBackOfficeCookieAuthentication(authOptions, appContext);

//This is a custom middleware, we need to return the user's remaining logged in seconds
app.Use<GetUserSecondsMiddleWare>(
authOptions,
UmbracoConfig.For.UmbracoSettings().Security,
app.CreateLogger<GetUserSecondsMiddleWare>());

app.UseUmbracoBackOfficeCookieAuthentication(authOptions);
//don't apply if app isnot ready
if (appContext.IsUpgrading || appContext.IsConfigured)
{
//This is a custom middleware, we need to return the user's remaining logged in seconds
app.Use<GetUserSecondsMiddleWare>(
authOptions,
UmbracoConfig.For.UmbracoSettings().Security,
app.CreateLogger<GetUserSecondsMiddleWare>());
}

return app;
}

internal static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, CookieAuthenticationOptions options)
internal static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, CookieAuthenticationOptions options, ApplicationContext appContext)
{
if (app == null)
{
Expand All @@ -170,12 +162,17 @@ internal static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBu
//First the normal cookie middleware
app.Use(typeof(CookieAuthenticationMiddleware), app, options);
app.UseStageMarker(PipelineStage.Authenticate);

//don't apply if app isnot ready
if (appContext.IsUpgrading || appContext.IsConfigured)
{
//Then our custom middlewares
app.Use(typeof(ForceRenewalCookieAuthenticationMiddleware), app, options, new SingletonUmbracoContextAccessor());
app.UseStageMarker(PipelineStage.Authenticate);
app.Use(typeof(FixWindowsAuthMiddlware));
app.UseStageMarker(PipelineStage.Authenticate);
}

//Then our custom middlewares
app.Use(typeof(ForceRenewalCookieAuthenticationMiddleware), app, options, new SingletonUmbracoContextAccessor());
app.UseStageMarker(PipelineStage.Authenticate);
app.Use(typeof(FixWindowsAuthMiddlware));
app.UseStageMarker(PipelineStage.Authenticate);

return app;
}
Expand All @@ -192,9 +189,6 @@ public static IAppBuilder UseUmbracoBackOfficeExternalCookieAuthentication(this
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
{
AuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
Expand Down

0 comments on commit 87100fe

Please sign in to comment.