-
-
Notifications
You must be signed in to change notification settings - Fork 58
Upgrading
- Umbraco 7.6.0 is a requirement, it will not work on lower versions.
- An external SQLCE logins table is no longer supported, all external login will be stored in an
externallogins
table in the Umbraco database. If you are currently using an external SQLCE file to store this data (maybe you started with a very old version) and you wish to retain the current data in this table, you will need to export this data from the SQLCE database and import it into theexternallogins
table in the Umbraco database. Alternatively if you do not retain this data it will mean that all of your members who have linked their accounts to 3rd party auth services would need to re-link them. - Some method signatures have changed, primarily the
UmbracoMembersUserManager.Create
methods no longer accept aDatabase
instance and instead require aDatabaseContext
instance, you will need to rebuild your solution and fix any compilation errors.
See milestone for more details: https://github.com/Shazwazza/UmbracoIdentity/milestone/7?closed=1
By default UmbracoIdentity will now store the ExternalLogins table in the Umbraco database instead of a separate SQL CE database. If you wish to use the new table storage within the Umbraco database you have 2 options:
- Leave the default configuration that you have, this will ensure that the db table is created in the Umbraco database, however it will be empty which means that any member that had previously linked an external account will no longer have that account linked. You can let them know they need to re-link their accounts OR...
- Once the database table is created in the Umbraco database, you can migrate the data from your existing SQL CE database at /App_Data/UmbracoIdentity.sdf to the ExternalLogins table in the Umbraco database
If you want to just keep using the separate SQL CE database that you currently have, you'll need to modify your startup options. By default you should have something like this:
app.ConfigureUserManagerForUmbracoMembers<UmbracoApplicationMember>();
but instead we need to specify some more complex options in order to have a custom ExternalLoginStore
used for the UmbracoMembersUserManager
, the code to do that will be:
app.ConfigureUserManagerForUmbracoMembers<UmbracoMembersUserManager<UmbracoApplicationMember>, UmbracoApplicationMember>(
ApplicationContext,
(options, context) => UmbracoMembersUserManager<UmbracoApplicationMember>.Create(
options,
ApplicationContext.Services.MemberService,
ApplicationContext.Services.MemberTypeService,
ApplicationContext.Services.MemberGroupService,
//custom login store to force the storage be in an external SQLCE db
new ExternalLoginStore(
ApplicationContext.ProfilingLogger.Logger,
ApplicationContext.DatabaseContext,
//use an external SQLCE db file
useSeparateDbFile: true)));
5.0.0 now supports ASP.NET Identity's security stamp. You will need to create a new property on your member types to support this, if you don't you will end up with a ton of warnings in your logs and the security stamp feature won't work very well. See: https://github.com/Shazwazza/UmbracoIdentity/wiki/Home/_edit#member-type-updates
Then to enable the security stamp check you will normally have this in your Startup class:
app.UseCookieAuthentication(
//You can modify these options for any customizations you'd like
new FrontEndCookieAuthenticationOptions(),
PipelineStage.Authenticate);
which you can change this this:
app.UseCookieAuthentication(new FrontEndCookieAuthenticationOptions
{
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user
// logs in. This is a security feature which is used when you
// change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator
.OnValidateIdentity<UmbracoMembersUserManager<UmbracoApplicationMember>, UmbracoApplicationMember, int>(
TimeSpan.FromMinutes(30),
(manager, user) => user.GenerateUserIdentityAsync(manager),
UmbracoIdentity.IdentityExtensions.GetUserId<int>)
}
}, PipelineStage.Authenticate);