Shazwazza/UmbracoIdentity

Extend membership provider configuration properties

osigas opened this issue · 2 comments

Rather than having to implement a custom version of UmbracoMembersUserManager for each build, it would be a time saver to be able to have some more configuration properties to control the basic features of the UserValidator and the PasswordValidator assigned to the UserManager.

e.g. from the web.config
<add name="UmbracoMembershipProvider" type="UmbracoIdentity.IdentityEnabledMembersMembershipProvider" passwordRequiresDigit="true" passwordRequiresLowercase="true" passwordRequiresUppercase="true" minRequiredNonalphanumericCharacters="1" minRequiredPasswordLength="10" ... />

These would pass through to the UmbracoMembersUserManager:
manager.PasswordValidator = new PasswordValidator { RequiredLength = provider.MinRequiredPasswordLength, RequireNonLetterOrDigit = provider.MinRequiredNonAlphanumericCharacters > 0, RequireDigit = provider.PasswordRequiresDigit, RequireLowercase = provider.PasswordRequiresLowercase, RequireUppercase = provider.PasswordRequiresUppercase };

PR in #102 where I had a stab at doing it myself.

Just testing this and may have to tweak a few things since this will essentially mean 'breaking changes'

  • The cookie name will change from the default .AspNet.ApplicationCookie to securitySection.AuthCookieName + "_MEMBERS"
  • Any configuration that is applied to the membership provider will now be applied to the user manager - which is good but might be a surprise to some

I think this is just a documentation thing so all good. I'll add to the release notes.

Thanks!!