Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • João Roque 11 posts 95 karma points
    Apr 05, 2021 @ 14:29
    João Roque
    0

    Custom Members implementation

    Hi,

    We are migrating and redesigning a project that was developed in Umbraco 8. It is scheduled to be finished in September and hopefuly the Umbraco netcore will be stable enough to be in a production ready state by then. We are starting development using the alpha 4 and will keep updating when new versions come out.

    The first roadblock I've encountered is regarding Members. We are looking to have the members saved in our database without relying on Umbraco to store it in the Umbraco database. I've researched the v9 source code and it looks like the netcore version of Members that uses Identity is almost ready, but not 100% yet. At least it was not in alpha 4.

    My questions are:

    • Is it possible to seamlessly use our own Identity in a project that has Umbraco? Will there be a conflict? I've tried, and currently users can't login to the Umbraco backoffice after adding the Identity scafolding. It adds the IdentityHostingStartup class which has an instruction in its ConfigureServices that does the following:
    services.AddDefaultIdentity<DBUser>(options => options.SignIn.RequireConfirmedAccount = false).AddEntityFrameworkStores<DBContext>();
    

    When I comment that instruction Umbraco Users can login, but of course, Identity no longer works in my code within my project.

    • In order to do my custom members implementation what classes / interfaces do I need to override / implement? I don't need viewing / editing / assigning members groups in Umbraco backoffice but I need the Umbraco group based public access control. Do I need more than IMemberManager, UmbracoIdentityUser, IMemberRepository and IMemberGroupRepository?

    • If I do my own implementations of those classes how do I configure Umbraco to inject them instead of the Umbraco native ones? I've looked at the dependency injection code but it seems that it can't be accessed by the project running the Umbraco package.

    • Do you have any idea if in the next version (beta 1) will have the members part 100% finished?

    Thanks,

    João

  • John Bergman 483 posts 1132 karma points
    Jul 11, 2021 @ 07:56
    John Bergman
    0

    Im interested in this as well with the RC. It looks like members now use ASP.NET Core Identity. Can anyone comment on which of the standard interfaces Umbraco relies on so that I can replace the implementation to match our other systems?

  • Chris Thwaites 14 posts 100 karma points
    Jun 09, 2022 @ 10:40
    Chris Thwaites
    0

    Hi There,

    Did anyone get anywhere with this? I have the exact same requirement (members to be saved in our own db).

    But I can't even get close to working out how to override the Umbraco Member Identity implementation.

    Thanks, Chris

  • Chris Thwaites 14 posts 100 karma points
    Jun 09, 2022 @ 18:43
    Chris Thwaites
    1

    If anyone is interested, I have got it working. The trick is to use

    services.AddIdentityCore<IdentityUser>()
                    .AddRoles<IdentityRole>().AddEntityFrameworkStores<DbContext>()
                    .AddTokenProvider<DataProtectorTokenProvider<IdentityUser>>(TokenOptions.DefaultProvider);
    
    services.TryAddScoped<UserManager<IdentityUser>>();
    services.TryAddScoped<SignInManager<IdentityUser>>();
    

    Instead of just

    services.AddIdentity<IdentityUser, IdentityRole>().AddEntityFrameworkStores<DbContext>();
    

    And set up the rest of the MS Identity stuff as normal. So far in my testing it has all worked as expected, and I'm still able to log into both the backoffice as a standard Umbraco User, and also to log in to the website as an AspNetUser.

    Hope this helps someone else, and saves them the days of trying all sorts of ideas I've spent...

  • RiMa 8 posts 119 karma points
    Aug 28, 2023 @ 19:34
    RiMa
    0

    Thank you, Chris Thwaites! Your response was very helpful.

Please Sign in or register to post replies

Write your reply to:

Draft