Skip to content

Instantly share code, notes, and snippets.

@Sam7
Last active March 9, 2018 04:28
Show Gist options
  • Save Sam7/613a92f2dd2c802ca8ea59f50f64a963 to your computer and use it in GitHub Desktop.
Save Sam7/613a92f2dd2c802ca8ea59f50f64a963 to your computer and use it in GitHub Desktop.
UmbracoCustomOwinStartup.Configuration.cs
public override void Configuration(IAppBuilder app)
{
//Configure the Identity user manager for use with Umbraco Back office
// *** EXPERT: There are several overloads of this method that allow you to specify a custom UserStore or even a custom UserManager!
app.ConfigureUserManagerForUmbracoBackOffice(
ApplicationContext.Current,
//The Umbraco membership provider needs to be specified in order to maintain backwards compatibility with the
// user password formats. The membership provider is not used for authentication, if you require custom logic
// to validate the username/password against an external data source you can create create a custom UserManager
// and override CheckPasswordAsync
MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
// Due to a problem with the cookie management caused by OWIN and ASP.NET we need to use this KentorOwinCookieSaver as described here: https://stackoverflow.com/a/26978166/465509
// If this isn't used, the external login will seemingly randomly stop working after a while.
app.UseKentorOwinCookieSaver();
//Ensure owin is configured for Umbraco back office authentication
base.Configuration(app);
// Configure additional back office authentication options
ConfigureBackOfficeAdfsAuthentication(app);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment