Updates the owin startup classes - we now have a default one shipped as a DLL which will always execute based on the appSettings, then we can ship with 2 optional ones that people can learn and use from which just requires them to update the appSetting. Now to decide on how to ship these .cs files
This commit is contained in:
@@ -5,14 +5,19 @@ using Umbraco.Core.Security;
|
||||
using Umbraco.Web.Security.Identity;
|
||||
using Umbraco.Web.UI;
|
||||
|
||||
[assembly: OwinStartup("UmbracoStartup", typeof(OwinStartup))]
|
||||
[assembly: OwinStartup("CustomUmbracoStartup", typeof(StandardUmbracoOwinStartup))]
|
||||
|
||||
namespace Umbraco.Web.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Default OWIN startup class as specified in appSettings
|
||||
/// A custom way to configure OWIN for Umbraco
|
||||
/// </summary>
|
||||
public class OwinStartup
|
||||
/// <remarks>
|
||||
/// The startup type is specified in appSettings under owin:appStartup - change it to "CustomUmbracoStartup" to use this class
|
||||
///
|
||||
/// This startup class would allow you to customize the Identity IUserStore and/or IUserManager for the Umbraco Backoffice
|
||||
/// </remarks>
|
||||
public class CustomUmbracoOwinStartup
|
||||
{
|
||||
public void Configuration(IAppBuilder app)
|
||||
{
|
||||
@@ -22,14 +27,13 @@ namespace Umbraco.Web.UI
|
||||
ApplicationContext.Current,
|
||||
Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
|
||||
|
||||
//Ensure owin is configured for Umbraco back office authentication. If you have any front-end OWIN
|
||||
// cookie configuration, this must be declared after it.
|
||||
//Ensure owin is configured for Umbraco back office authentication
|
||||
app
|
||||
.UseUmbracoBackOfficeCookieAuthentication()
|
||||
.UseUmbracoBackOfficeExternalCookieAuthentication();
|
||||
|
||||
/*
|
||||
* Configure external logins:
|
||||
* Configure external logins for the back office:
|
||||
*
|
||||
* Depending on the authentication sources you would like to enable, you will need to install
|
||||
* certain Nuget packages.
|
||||
@@ -47,7 +51,7 @@ namespace Umbraco.Web.UI
|
||||
* methods to suit your needs.
|
||||
*/
|
||||
|
||||
//app.ConfigureBackOfficeGoogleAuth("1072120697051-p41pro11srud3o3n90j7m00geq426jqt.apps.googleusercontent.com", "ak0msWvSE4w9nujcsfVy8_Y0");
|
||||
//app.ConfigureBackOfficeGoogleAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
|
||||
//app.ConfigureBackOfficeFacebookAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
|
||||
//app.ConfigureBackOfficeMicrosoftAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
|
||||
//app.ConfigureBackOfficeActiveDirectoryAuth("YOUR_TENANT", "YOUR_CLIENT_ID", "YOUR_POST_LOGIN_REDIRECT_URL", "YOUR_APP_KEY", "YOUR_AUTH_TYPE");
|
||||
50
src/Umbraco.Web.UI/App_Start/StandardUmbracoOwinStartup.cs
Normal file
50
src/Umbraco.Web.UI/App_Start/StandardUmbracoOwinStartup.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Microsoft.Owin;
|
||||
using Owin;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Web.Security.Identity;
|
||||
using Umbraco.Web.UI;
|
||||
|
||||
[assembly: OwinStartup("StandardUmbracoStartup", typeof(StandardUmbracoOwinStartup))]
|
||||
|
||||
namespace Umbraco.Web.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// The standard way to configure OWIN for Umbraco
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The startup type is specified in appSettings under owin:appStartup - change it to "StandardUmbracoStartup" to use this class
|
||||
/// </remarks>
|
||||
public class StandardUmbracoOwinStartup : DefaultUmbracoOwinStartup
|
||||
{
|
||||
public override void Configuration(IAppBuilder app)
|
||||
{
|
||||
//ensure the default options are configured
|
||||
base.Configuration(app);
|
||||
|
||||
/*
|
||||
* Configure external logins for the back office:
|
||||
*
|
||||
* Depending on the authentication sources you would like to enable, you will need to install
|
||||
* certain Nuget packages.
|
||||
*
|
||||
* For Google auth: Install-Package Microsoft.Owin.Security.Google
|
||||
* For Facebook auth: Install-Package Microsoft.Owin.Security.Facebook
|
||||
* For Microsoft auth: Install-Package Microsoft.Owin.Security.MicrosoftAccount
|
||||
*
|
||||
* There are many more providers such as Twitter, Yahoo, ActiveDirectory, etc... most information can
|
||||
* be found here: http://www.asp.net/web-api/overview/security/external-authentication-services
|
||||
*
|
||||
* The source for these methods is located in ~/App_Code/IdentityAuthExtensions.cs, you will need to un-comment
|
||||
* the methods that you would like to use. Each method contains documentation and links to
|
||||
* documentation for reference. You can also tweak the code in those extension
|
||||
* methods to suit your needs.
|
||||
*/
|
||||
|
||||
//app.ConfigureBackOfficeGoogleAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
|
||||
//app.ConfigureBackOfficeFacebookAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
|
||||
//app.ConfigureBackOfficeMicrosoftAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
|
||||
//app.ConfigureBackOfficeActiveDirectoryAuth("YOUR_TENANT", "YOUR_CLIENT_ID", "YOUR_POST_LOGIN_REDIRECT_URL", "YOUR_APP_KEY", "YOUR_AUTH_TYPE");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -357,7 +357,8 @@
|
||||
<Compile Include="..\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App_Start\OwinStartup.cs" />
|
||||
<Compile Include="App_Start\CustomUmbracoOwinStartup.cs" />
|
||||
<Compile Include="App_Start\StandardUmbracoOwinStartup.cs" />
|
||||
<Compile Include="App_Start\UmbracoBackOfficeAuthExtensions.cs" />
|
||||
<Compile Include="Umbraco\Install\Legacy\LoadStarterKits.ascx.cs">
|
||||
<DependentUpon>loadStarterKits.ascx</DependentUpon>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<add key="enableSimpleMembership" value="false" />
|
||||
<add key="autoFormsAuthentication" value="false" />
|
||||
<add key="log4net.Config" value="config\log4net.config" />
|
||||
<add key="owin:appStartup" value="UmbracoStartup" xdt:Transform="InsertIfMissing" xdt:Locator="Match(key)" />
|
||||
<add key="owin:appStartup" value="DefaultUmbracoStartup" xdt:Transform="InsertIfMissing" xdt:Locator="Match(key)" />
|
||||
</appSettings>
|
||||
|
||||
<connectionStrings xdt:Transform="Remove" xdt:Locator="Condition(@configSource != '')" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<add key="autoFormsAuthentication" value="false" />
|
||||
|
||||
<add key="log4net.Config" value="config\log4net.config" />
|
||||
<add key="owin:appStartup" value="UmbracoStartup" />
|
||||
<add key="owin:appStartup" value="DefaultUmbracoStartup" />
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
<remove name="umbracoDbDSN" />
|
||||
|
||||
35
src/Umbraco.Web/DefaultUmbracoOwinStartup.cs
Normal file
35
src/Umbraco.Web/DefaultUmbracoOwinStartup.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Microsoft.Owin;
|
||||
using Owin;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Security.Identity;
|
||||
|
||||
[assembly: OwinStartup("DefaultUmbracoStartup", typeof(DefaultUmbracoOwinStartup))]
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
/// <summary>
|
||||
/// The default way to configure OWIN for Umbraco
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The startup type is specified in appSettings under owin:appStartup
|
||||
/// </remarks>
|
||||
public class DefaultUmbracoOwinStartup
|
||||
{
|
||||
public virtual void Configuration(IAppBuilder app)
|
||||
{
|
||||
//Configure the Identity user manager for use with Umbraco Back office
|
||||
// (EXPERT: an overload accepts a custom BackOfficeUserStore implementation)
|
||||
app.ConfigureUserManagerForUmbracoBackOffice(
|
||||
ApplicationContext.Current,
|
||||
Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
|
||||
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,6 +306,7 @@
|
||||
</Compile>
|
||||
<Compile Include="ApplicationContextExtensions.cs" />
|
||||
<Compile Include="AreaRegistrationContextExtensions.cs" />
|
||||
<Compile Include="DefaultUmbracoOwinStartup.cs" />
|
||||
<Compile Include="IUmbracoContextAccessor.cs" />
|
||||
<Compile Include="Models\ContentEditing\Relation.cs" />
|
||||
<Compile Include="HtmlStringUtilities.cs" />
|
||||
|
||||
Reference in New Issue
Block a user