ITenantProvider Interface

The ITenantProvider interface is used to implement a custom tenant identifier provider for use in a multitenant environment.

During system startup, the init(Map, String) method will be called once per configured instance. While the system is running, getTenantId(IAccount) will be called as accounts are logged on to. The destroy() method will be called at system shutdown.

By obtaining tenant identifiers for authenticated users, you could potentially associate a user session with a tenant.

The following methods are available in the ITenantProvider interface.

destroy
Destroys this ITenantProvider and frees resources held by it. This method is called during the system shutdown process.
getTenantId
Returns the tenant identifier that the provided account belongs to. An empty string will be returned for public accounts. A tenantID may contain any Unicode characters, with the exception of tabs, carriage returns, and line feeds. Leading and trailing spaces are trimmed, and consecutive internal spaces are reduced to one. A tenantID consisting only of spaces is reduced to an empty string, which is reserved for public content.
init
Initializes the ITenantProvider interface. This method is called during the system startup process.

If the initialization or tenantID retrieval process fails to complete, the init or getTenantId methods may be returned with an UnrecoverableException error.