## 4.1.4.2.2.12  Multitenancy
Each multitenant application has to deploy its own application router, and the application router handles requests of all tenants to the application. The application router is able to determine the tenant identifier out of the URL and then forwards the authentication request to the tenant User Account and Authentication (UAA) service and the related identity zone.
To use a multitenant application router, you must have a shared UAA service and the version of the application router has to be greater than 2.3.1.
The application router must determine the tenant-specific subdomain for the UAA that in turn determines the identity zone, used for authentication. This determination is done by using a regular expression defined in the environment variable TENANT\_HOST\_PATTERN .
TENANT\_HOST\_PATTERN is a string containing a regular expression with a capturing group. The request host is matched against this regular expression. The value of the first capturing group is used as the tenant subdomain.
If you have multiple routes to the same application, for example:
tenant1.&lt;application domain&gt; and tenant2.&lt;application domain&gt;
The TENANT\_HOST\_PATTERN could be:
```
TENANT_HOST_PATTERN: "^(.*).<application domain>"
```
With this configuration, the application router extracts the tenant subdomain, which is used for authentication against a multitenant UAA.
## Register an Application (SaaS Registry Configuration)
Create a service instance of the SaaS Provisioning service with a configuration JSON file in the Cloud Foundry sub-account space where the multitenant business application is deployed.
The configuration JSON file must use the following format and set these properties:
```
{ "xsappname" : "<xsappname>", "appUrls": { "getDependencies" : "<approuter-host>/<getDependenciesPath>/{tenantId}", "onSubscription" : "<approuter-host>/<onSubscriptionPath>/{tenantId}" }, "displayName" : "<displayName>", "description" : "<description>", "category" : "<category>" }
```
Specify the following parameters:
| Parameters          | Description                                                                                                                                                                                                                                                                                                                                                                                                                           |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| xsappname           | The xsappname configured in the security descriptor file used to create the XSUAA instance (see Develop the Multitenant Application [page 391]).                                                                                                                                                                                                                                                                                      |
| getDependenciesPath | (Optional) Any URL that the application exposes for GET dependencies. If the ap- plication doesn't have dependencies and the callback isn't implemented, it mustn't be declared.                                                                                                                                                                                                                                                      |
| onSubscriptionPath  | This parameter must end with /{tenantId} . The tenant for the subscription is passed to this callback as a path parameter. You must keep {tenantId} as a pa- rameter in the URL so that it's replaced at runtime with the tenant calling the sub- scription. This callback URL is called when a subscription between a multitenant application and a consumer tenant is created (PUT) and when the subscription is removed (DELETE) . |
| displayName         | (Optional) The display name of the application when viewed in the cockpit. For example, in the application's tile. If left empty, takes the application's technical name.                                                                                                                                                                                                                                                             |
| description         | (Optional) The description of the application when viewed in the cockpit. For exam- ple, in the application's tile. If left empty, takes the application's display name.                                                                                                                                                                                                                                                              |
| category            | (Optional) The category to which the application is grouped in the Subscriptions page in the cockpit. If this parameter is left empty, it's assigned to the default category.                                                                                                                                                                                                                                                         |
##  Note
For information about how to model the security settings for activating the saas-registry callbacks, see Develop the Multitenant Application [page 391].
## Related Information
Developing Multitenant Applications in the Cloud Foundry Environment [page 388] Register the Multitenant Application to the SAP SaaS Provisioning Service [page 398]