Finbuckle.MultiTenant icon indicating copy to clipboard operation
Finbuckle.MultiTenant copied to clipboard

How to use multitenancy over an Ocelot Api Gateway?

Open zahidcakici opened this issue 1 year ago • 1 comments

Hi, I work on a multitenant microservice architecture. I have also IdentityServer4 on my arch and tenants info are kept there with users. The request sended by client is being checked on both Ocelot and on Resource Api. So I need to know what tenant to move on in both Gateway and Resource Api.

I know that I can implement mutitenancy on both sides but we use remote store since we keep tenant dbcontext on IdentityServer. So I thougth that would cause some performance issues because a request would had to go to IdentityServer two times for checking tenantInfo and for Auth operations, both on Gateway and the resource side.

First I tried to implement Finbuckle.Multitenant on Gateway only and tried to carry TenantInfo by context to the resourse microservice but I am not sure if that's possible. I couldn't manage it. How can I implement an efficient solution to this problem? Or would this even cause a performance problem like I guess?

Thanks in advance.

zahidcakici avatar Jul 25 '22 12:07 zahidcakici

hi I'm sorry I'm not familiar with Ocelot but perhaps someone else will be able to help you. I see what you mean about performance as a concern. I'd probably go with some sort of smart caching so the API gateway wouldn't have to constant query the tenant store but it's not a trivial thing to setup.

AndrewTriesToCode avatar Aug 10 '22 05:08 AndrewTriesToCode

This issue has been automatically marked for closure because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 02 '22 06:11 stale[bot]