Are you using the default ApplicationUserManager, or are you using your custom implementation?
Hi Quan, and thanks for your reply. I am using the default ApplicationUserManager, but with Episervers UIUserManager "in front".
For starter I think you just need to add this to your Startup.Configuration, you don't have such long configuration for structuremap
Thanks again Quan!
Since I've migrated an existing site with existing users, I've added a custom implementation as suggested by K Khan. The implementation is equal to Episervers default, except the call to
app.CreatePerOwinContext<ApplicationUserManager<TUser>>(new Func<IdentityFactoryOptions<ApplicationUserManager<TUser>>, IOwinContext, ApplicationUserManager<TUser>>(ApplicationUserManager<TUser>.Create));
That is changed to
CreateApplicationUserManager is setting up a custom SqlPasswordHasher and also the Password validator. This is as per Episervers documentation.
The password validator is what causes the error for me, but removing it prevents me from logging in with my old password.
As I can see, this is a straight forward implementation as per documentation and should just work..
I have migrated an existing Episerver site to ASP.Identity, pretty much following K Khans blogpost. The site is running newest version of Episerver. At first I was struggeling to get Episervers Identity implementation (using UIUserProvider, UIRoleProvider and UISignInManager) to work with Structure map. After explicit adding interfaces and abstract classes to Structure map config, I've got everything to work except validating a users password when creating or updating users in admin mode:
Unable to cast object of type 'Microsoft.AspNet.Identity.MinimumLengthValidator' to type 'Microsoft.AspNet.Identity.PasswordValidator'.
at EPiServer.Cms.UI.AspNetIdentity.ApplicationUserProvider`1.get_MinRequiredPasswordLength() at EPiServer.UI.Edit.UserMembership.ValidatePassword() at EPiServer.UI.Edit.UserMembership.SaveMembershipUser(IEnumerable`1& errors)
at EPiServer.UI.Edit.UserMembership.SaveButton_Click(Object sender, EventArgs e)
I guess there is a simple solution to this, but I've already spent way too much time trying to make it work. Any help or suggestions are greatly appreciated.
Thanks in advance,
From Structure map config: