AdminUsersFeature

Does the AdminUsersFeature work with this template: https://blazor-wasm.web-templates.io

I tried to add the following to my Configure.AuthQuery.cs

            services.AddSingleton<IAuthRepository>(c =>
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));
            appHost.Plugins.Add(new AdminUsersFeature());
            appHost.Resolve<IAuthRepository>().InitSchema();

And then when I navigate to the /admin_ui/ route I get the following error once I try to login:

I’m thinking maybe this is not 100% compatible with the new AuthFeature implementation and .Net 8?

Right AdminUsersFeature only works for ServiceStack Auth. Likewise all related classes like IAuthRepository and OrmLiteAuthRepository etc are only for ServiceStack Auth.

Ahh I C.

Will you be releasing an updated that allows it to work with the new AuthFeature implementations?

AdminUsersFeature only supports ServiceStack Auth, an entire new implementation would be needed for managing ASP .NET Identity Users.

We’ll eventually want to add Admin Users functionality to manage ASP .NET Core Users although still not sure what the best approach is, i.e. whether to include it in the templates, build it within Admin UI, try to update users table directly, try to use new Identity Auth APIs, etc. Will require a bit of R&D to determine what the best approach would be.

1 Like

Hi @mythz

Any movement on the AdminUsersFeature supporting the new ASP.NET Identity Users?

Not yet as we’re working on other higher priority features atm, but should hopefully be able to get to it either this release or next.

1 Like

This is now implemented in the ASP.NET Core Identity Auth Admin UI that’s now available in today’s ServiceStack v8.1 release.

Awesome!

I tried refreshing my template with the new version but I’m seeing the following issue.

I can sign in as admin and see the admin side of the template:

But when I click on the View All Database Tables, it wants me to log in again, but this time the login errors out saying:
image

which coincides with a 401 on the auth route.
image

When I compare to a clean template I notice the secondary login works (however it doesn’t ask for my 2FA), and if I navigate away and come back I need to authenticate again, but I get the 200 on the Authenticate.
image

Any ideas where to look for this disconnect?

@Charles If you delete the Auth.razor file in MyApp.Client/Pages it should fix it. I believe the /auth route was interfering with the login process for the admin.

I’ve updated the template with this fix so x new blazor-wasm MyApp will work as well, but you might need to run x --clear first.

1 Like