JonPSmith / AuthPermissions.AspNetCore

This library provides extra authorization and multi-tenant features to an ASP.NET Core application.
https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/
MIT License
807 stars 161 forks source link

AuthP working with Azure App Configuration #110

Closed pradeepgururani closed 7 months ago

pradeepgururani commented 7 months ago

We are using AuthP v6.2. We are going to deploy our service as Azure App service along with Azure App Configuration.

While using Azure App Configuration there is feature of prefixing settings so that same Azure App Configuration instance can be used by different components.

I have created the prefix "WebApi". With this my ConnectionStrings section is no more accessible by the same name. With prefix it has to be accessed by WebApi:ConnectionStrings.

SetupMultiTenantSharding method in AuthPermissions.AspNetCore.SetupExtensions is trying to get the section by ConnectionStrings name and failing.

setupData.Services.Configure(setupData.Options.Configuration.GetSection("ConnectionStrings"));

If I may suggest, I would suggest either of following two options:

JonPSmith commented 7 months ago

Hi @pradeepgururani,

Your option 2 is possible because you can create a custom method to replace the normal SetupMultiTenantSharding setup. This allows you add add / change the code to the multi-tenant setup code. This was added in version 5 to allow you use different database types - see this section from the 'Setup a custom database, which has a link to an example SetupMultiTenantShardingCustomDb custom method.