From 32d5a0a57c2076f15a4e4d177116ea2e74d1685a Mon Sep 17 00:00:00 2001 From: Bitmapped Date: Wed, 30 Aug 2017 20:04:30 -0400 Subject: [PATCH 1/3] Add method for configuring external logins so things can be granularly overriden. --- src/Umbraco.Web/UmbracoDefaultOwinStartup.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index 5773d88f73..31159a91b2 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -28,6 +28,7 @@ namespace Umbraco.Web ConfigureServices(app); ConfigureMiddleware(app); + ConfigureExternalLogins(app); } /// @@ -68,6 +69,15 @@ namespace Umbraco.Web Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider()); } + /// + /// Configure external oAuth login providers + /// + /// + protected virtual void ConfigureExternalLogins(IAppBuilder app) + { + // Code for configuring external login/oAuth providers goes here. + } + /// /// Raised when the middleware has been configured /// From 65db5396cf325989cebab0ff677a84ee241ebe27 Mon Sep 17 00:00:00 2001 From: Bitmapped Date: Wed, 30 Aug 2017 20:06:20 -0400 Subject: [PATCH 2/3] Spelling fix --- src/Umbraco.Web/UmbracoDefaultOwinStartup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index 31159a91b2..e78c82ccbd 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -70,12 +70,12 @@ namespace Umbraco.Web } /// - /// Configure external oAuth login providers + /// Configure external/OAuth login providers /// /// protected virtual void ConfigureExternalLogins(IAppBuilder app) { - // Code for configuring external login/oAuth providers goes here. + // Code for configuring external login/OAuth providers goes here. } /// From 606abd8ac7f32c9a7278fed58939827ccece94c0 Mon Sep 17 00:00:00 2001 From: Bitmapped Date: Wed, 6 Sep 2017 00:43:27 -0400 Subject: [PATCH 3/3] Restructure per discussion in U4-10369 --- src/Umbraco.Web/UmbracoDefaultOwinStartup.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index e78c82ccbd..342b8daa16 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -28,7 +28,6 @@ namespace Umbraco.Web ConfigureServices(app); ConfigureMiddleware(app); - ConfigureExternalLogins(app); } /// @@ -47,12 +46,11 @@ namespace Umbraco.Web /// protected virtual void ConfigureMiddleware(IAppBuilder app) { - //Ensure owin is configured for Umbraco back office authentication. If you have any front-end OWIN - // cookie configuration, this must be declared after it. + + // Configure OWIN for authentication. + ConfigureUmbracoAuthentication(app); + app - .UseUmbracoBackOfficeCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) - .UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) - .UseUmbracoPreviewAuthentication(ApplicationContext, PipelineStage.Authorize) .UseSignalR() .FinalizeMiddlewareConfiguration(); } @@ -73,9 +71,14 @@ namespace Umbraco.Web /// Configure external/OAuth login providers /// /// - protected virtual void ConfigureExternalLogins(IAppBuilder app) + protected virtual void ConfigureUmbracoAuthentication(IAppBuilder app) { - // Code for configuring external login/OAuth providers goes here. + // Ensure owin is configured for Umbraco back office authentication. + // Front-end OWIN cookie configuration must be declared after this code. + app + .UseUmbracoBackOfficeCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) + .UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) + .UseUmbracoPreviewAuthentication(ApplicationContext, PipelineStage.Authorize); } ///