Copied to clipboard

Flag this post as spam?

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


  • mmaty 100 posts 230 karma points
    6 days ago
    mmaty
    0

    Howto use my own data sources for roles and members?

    I got completely lost in the task of porting a pair of Custom Membership Provider / Role Provider from Umbraco 8 to Umbraco 10.

    All the examples I've found so far show how to use external OpenId Connect implementations so that the Umbraco members work with those authentication providers.

    However, this is not helpful for my current project.

    Let's start with the roles that are granted access to specific pages in Umbraco. In my old system, I have a Custom Role Provider that retrieves an array of roles, which Umbraco then displays in the dialog for securing a document. The implementation of where these roles come from is entirely up to me. In my case there is a service I can get the roles from. This is totally simple and works well.

    How can I achieve something like this in ASP.NET Core? All the examples covering this issue are extremely tightly tied to the Entity Framework. In my case, however, I want to retrieve the roles using a REST API. In previous versions I was able to do this with a Custom Role Provider. In Umbraco 10 I don't know at all where to start.

    All examples in the web show some startup configurations of .NET Core sites. But in Umbraco the startup code for ASP.NET Core is hidden in Umbraco's source code and I have no idea how to override the behavior in my own startup code.

    Let's continue with the login. In the old system there is a redirect to a login service showing the login dialog, which then makes a callback to the Umbraco system after a successful login. I think that's not too complicate to implement with Umbraco 10.

    In the callback of the old system I can now define the user name with FormsAuthentication.SetAuthCookie. Now the Custom Membership Provider comes into play. Umbraco uses the provider to retrieve information about the member. It was absolutely simple to call a REST API in my custom provider, to achieve this task. Umbraco was able to work with the member, as if it came from the own database.

    Again, I have the problem with Umbraco 10 that I don't know how to persuade the Umbraco system to use my own user data. This data does not come from the Umbraco database, but from the REST service.

    So my question here is: How can I get Umbraco to use my own role and user data in the simplest way possible?

Please Sign in or register to post replies

Write your reply to:

Draft