Open Closed

API Key Authorization Filter #8952


User avatar
0
stephanobalbinot created
  • ABP Framework version: v8.3.4
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Some of my tenants have a worker service implemented on-premises. I am authenticating them via the Client Credentials flow in my AuthServer. Now, I need to implement an authorization filter using an API key that is configured as a SettingDefinition for each tenant that needs to use these worker services.

My question is: How can I retrieve the provider key (tenant ID) based on the value of the API key setting? Then, I need to adjust the request scope to the tenant obtained from that provider key.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    It seems there is no built-in way to retrieve it. But you can override SettingProvider in your application and add another method that applies your custom query by using re https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs

    but still you won't be able to access to data source directly to apply a custom query with value, you can also override on of the existing Setting Value Providers https://abp.io/docs/9.0/framework/infrastructure/settings#setting-value-providers

    which is TenantSettingValueProvider in this case: https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantSettingValueProvider.cs

    Or you can create your own value provider according to your custom requirements and configure it:

    Configure<AbpSettingOptions>(options =>
    {
        options.ValueProviders.Add<CustomSettingValueProvider>();
    });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.