AspnetIdentity - ApplicationUserProvider<TUser>

We are importing an existing user base to our new episerver project.  The legacy cms had a salt value per user row, so I created a custom application user and introduced teh additional property of Salt value.

All is implemented fine, but I am having some problems with the above class, the abstract CreateUser method defines a fixed number of arguments, so I cant add my new salt value method.  One work around I had thought of was to perform an update immediately after creation with the salt value, not ideal but it would work.  However, I would like the admin users to still be able to use the create user facility in the backend and this will only make use of createuser method with no salt value.

Is there a way to replace the create user method globally, or alter the admin ui create user function to also perform the additional update?

#180925 Aug 02, 2017 17:33
  • Member since: 2008
    #180948 Aug 02, 2017 22:56
  • hi David, fantastic!  Thats exactly what I needed, thank you :)

    #180970 Aug 03, 2017 18:39
  • Member since: 2008

    Hi Adam

    Thats great news! If you find it useful can you mark as answered so other members of the community can benefit from the answer :)?


    #180988 Aug 04, 2017 10:11
  • No problem.

    What i did in the end was completely intercept the createuser call only and implemented the extra field.  To be able to do that you need to set the return value of the intercept and you will need an instance of the application user manager.  Currently I have implemented identity as per the alloy example, so its not instantiated through DI, in which case I got my instance of applicatioin user manager by injecting the httpcontext and passing an instance of the OwinContext to create an instance of application user manager (typed to my user).

    If you have a multi user type (in terms of class, not role) then you might want to specify the type of UiUserProvider when declaring the intercept, for my example we only have the one type of user class so this wasnt necessary.

    #180993 Edited, Aug 04, 2017 13:26
  • Member since: 2008

    Thanks for sharing your experience Adam! Happy inercepting :)

    #180994 Aug 04, 2017 13:31