Starts in:
2 DAYS
8 HRS
19 MIN
35 SEC
Starts in:
2 D
8 H
19 M
35 S

Activities of "dboutwell"

Identity client is used for front-end (angular, mvc, blazor, console....), not Tenant.

Ok, this makes sense. So what is the recommended approach within the ABP framework if I wanted to extend some of the API functionality to tenants?

  • ABP Framework version: v5.1.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

We are using the commercial module to build out our client portal, but we would like to extend certain API access to clients directly for them to consume. So, my question is:

  1. Is there a way to create an API client and tie it to a specific client?
  2. Is the functionality for managing that already in the UI?

I can see and have created OAuth2 clients in the Identity Server -> Clients section, but the documentation assumes a level of understanding of this identity server that I just do not have. So, is there a specific set of claims or anything on the "Advanced" tab that I can set inside the current UI setup in order to restrict a specific connection to a specific TenantId?

Not sure if this will be made public, but the solution I landed on was overriding the FindByNameAsync method in the EfCoreTenantRepository class so that the tenant creation process and the the domain resolver will both be operating out of the same playbook.

It's probably not the most efficient code, but this is what that override class looks like now:

[Dependency(ReplaceServices = true)]
    public class CustomTenantRepository : EfCoreTenantRepository
    {
        public CustomTenantRepository(IDbContextProvider<ISaasDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        public override async Task<Tenant> FindByNameAsync(string name, bool includeDetails = true, CancellationToken cancellationToken = default)
        {
            var tenants = await (await GetDbSetAsync())
                .IncludeDetails(includeDetails)
                .OrderBy(t => t.Id).ToListAsync();


            return tenants
                .FirstOrDefault(t => (t.Name == name || TestUrlNamingConvention(t.Name,name)));
        }

        private bool TestUrlNamingConvention(string tenantName, string inputName)
        {
            var i = string.Concat(inputName.Where(c => !char.IsWhiteSpace(c))).ToLowerInvariant();
            var t = string.Concat(tenantName.Where(c => !char.IsWhiteSpace(c))).ToLowerInvariant();

            return i == t;              
        }
    }

And because I often find myself asking where I should put these, I have mine in the Project.EntityFrameworkCore project.

hi

You can custom the DomainTenantResolveContributor.

https://docs.abp.io/en/abp/latest/Multi-Tenancy#custom-tenant-resolvers

https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/DomainTenantResolveContributor.cs

That is where I started, and the domain tenant resolver does successfully match the domain value (in this case norules) from the URL but I am then pushed to a screen that simply states:

Tenant not found!

There is no tenant with the tenant id or name: norules

So what I am looking for is to modify whatever routine looks at the SaasTenants table AFTER the domain resolver pulls the deal and tell it to match on something like:

Regex.Replace(Tenant.Name, @"\s", "");

  • ABP Framework version: v5.1.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: N/A
  • Steps to reproduce the issue:"

Not a bug, per se, but I was wondering what would be the easiest way to extend the Domain Tenant Resolver functionality with custom string rules for matching on the tenant name side?

For example, I have a tenant with the name "No Rules" in the database, and I want to match on "norules.localhost", but the system keeps kicking back that it can't find a tenant with that name.

So, what I am looking to do is one of two things (whichever is easiest):

  • tell the system to match on the name string with all of the whitespace removed
  • update the "new tenant" form to not allow whitespace characters in the name field

Let me know if you need any code from my side. Thus far the project is very close to the commercial startup template.

Showing 11 to 15 of 15 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06