我有一個需要租戶作爲標頭的API。如何使用WSO2 API管理器在中介中將租戶設置爲標頭
如果我創建序列的自定義:
<sequence name="WSO2AM--Ext--In">
<header
name="X-Tenant-Id"
scope="transport"
action="set"
expression="???????????????????"
/>
</sequence>
有沒有我可以用它來實現這一目標的體現在哪裏?或者我應該採用創建一個API調解器來設置它?
PS: 看着WSO2的源代碼(CarbonTenantInfoConfigurator.java),我發現這個片段可能是有用的提示:
PrivilegedCarbonContext cc = PrivilegedCarbonContext.getThreadLocalCarbonContext();
String tenantDomain = cc.getTenantDomain();
int tenantId = cc.getTenantId();
messageContext.setProperty("tenant.info.domain", tenantDomain);
messageContext.setProperty("tenant.info.id", tenantId);
但我不知道如何訪問這些屬性自定義序列,如果可能的話。
這就是我一直在尋找的東西,它工作的很棒。謝謝! –