JonPSmith / AuthPermissions.AspNetCore

This library provides extra authorization and multi-tenant features to an ASP.NET Core application.

Home Page:https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AuthP working with Azure App Configuration

pradeepgururani opened this issue · comments

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:

  • Allow user of this library to get the section and configure as part of AuthP setup. Dev could directly bind to custom section or do it in IOption pattern way.
  • Allow user to specify the custom name if any as part of SetupMultiTenantSharding call. If none is provided then ConnectionStrings can be fallback option.

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.