Hi,
I’m using TMS Sphinx in a user-level multitenant scenario. In my authentication server I allow the same user to exist in different tenants, so the request must include the tenant_id for the filter to work.
On the server side, in the OnManagerCreate event, I do this:
procedure TdtmAPIAutenticacaoServidor.SphinxServerAPIManagerCreate(
Sender: TObject; Args: TManagerCreateArgs);
begin
var TenantId: String := Args.Handler.Context.RequiredItem<ITenant>.TenantId;
Args.Manager.EnableFilter('Multitenant').SetParam('tenant_id', TenantId);
end;
With that, Sphinx applies the filter correctly as long as the request actually contains the tenant.
The issue is on the client side: I’m using the TSphinxLogin component (the one that builds the authorization URL for me), and I couldn’t find a place to tell it which tenant I want to authenticate against. So when the URL is generated, this information is not added, and my auth server responds that the tenantId is required.
If I manually tweak the URL and add the query param, for example:
.../connect/authorize?...&X-Tenant-Id=123
then it works. So the backend is fine and the multitenant filter is working.
My question is:
is there currently an official way in TSphinxLogin to:
- add extra query parameters to the authorization URL (such as
X-Tenant-Idortenant_id); - or intercept the URL right before it is used so I can append the tenant;
- or some property that was meant for multitenant scenarios?
From what I saw, the component doesn’t expose something like ExtraParams for this. Before I subclass the component or build the flow manually, I wanted to check if there is already a recommended extension point from TMS.
Context recap:
- Sphinx server with multitenant filter working;
- Delphi client using
TSphinxLogin; - server requires
tenantId; - if I add
&X-Tenant-Id=123manually, it works; - I need to do that directly through the component.
If there is an event/property I missed, or if this should be considered as a small enhancement request for the component (to allow custom query params), I’d really appreciate some guidance.