#### [Abblix\.Oidc\.Server](https://www.abblix.com/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Features\.MultiTenancy](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy 'Abblix\.Oidc\.Server\.Features\.MultiTenancy')

## ITenantCatalog Interface

Finds the tenants a deployment serves\.

```csharp
public interface ITenantCatalog
```

Derived  
↳ [StoreTenantCatalog](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.StoreTenantCatalog 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.StoreTenantCatalog')

### Remarks
Asked on every request, so an implementation answers from memory where it can\.

What is built from a tenant's definition - its scopes, resources, pairwise converter and clients - is kept for
the tenant and built again once the definition hands out other objects for them. So a catalog answers with the
same objects until the definition really changes: one building a fresh definition for every lookup has all of
them rebuilt on every request. With the server's own catalog ([StoreTenantCatalog](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.StoreTenantCatalog 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.StoreTenantCatalog')) what was built
from a tenant's definition in force - the one it serves now, or the last one it served - is not replaced from
another, so a request still holding one it replaced is answered with what was built; with any other catalog, one
wrapping the server's own included, such a request builds them back from the definition it holds. The checks of
the tenant list judge what the server's own catalog reads, so a catalog of the host's own gets none of them, while
one wrapping the server's passes on only what they let through.

Likewise only the server's own catalog readies a tenant before serving it ([ITenantOpening](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.ITenantOpening 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.ITenantOpening')), and a
server minting its keys keeps a key only for the tenants that catalog serves. So a catalog of the host's own
answers with no tenant the server's catalog does not serve, or every request to that tenant needing a key fails,
the key ring keeping no partition for it.

The server uses the definition it is handed, so a catalog of the host's own answers with the definition in force,
and the host enters a tenant scope with the definition in force too.
### Methods

## ITenantCatalog\.FindByAddressAsync\(string, string, CancellationToken\) Method {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByAddressAsync(string,string,System.Threading.CancellationToken)}

The tenant served at [host](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByAddressAsync(string,string,System.Threading.CancellationToken).host 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.ITenantCatalog\.FindByAddressAsync\(string, string, System\.Threading\.CancellationToken\)\.host') and [path](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByAddressAsync(string,string,System.Threading.CancellationToken).path 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.ITenantCatalog\.FindByAddressAsync\(string, string, System\.Threading\.CancellationToken\)\.path'): the one whose issuer names that
host and, among those, the longest whole\-segment start of the path; null when no issuer covers it\.

```csharp
System.Threading.Tasks.ValueTask<Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition?> FindByAddressAsync(string host, string path, System.Threading.CancellationToken cancellationToken);
```
#### Parameters

###### `host` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByAddressAsync(string,string,System.Threading.CancellationToken).host}

###### `path` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByAddressAsync(string,string,System.Threading.CancellationToken).path}

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByAddressAsync(string,string,System.Threading.CancellationToken).cancellationToken}

#### Returns
[System\.Threading\.Tasks\.ValueTask&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1 'System\.Threading\.Tasks\.ValueTask\`1')[TenantDefinition](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.TenantDefinition')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1 'System\.Threading\.Tasks\.ValueTask\`1')

## ITenantCatalog\.FindByIdAsync\(string, CancellationToken\) Method {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByIdAsync(string,System.Threading.CancellationToken)}

The tenant registered under [tenantId](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByIdAsync(string,System.Threading.CancellationToken).tenantId 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.ITenantCatalog\.FindByIdAsync\(string, System\.Threading\.CancellationToken\)\.tenantId'), compared exactly, or null when there is none\.

```csharp
System.Threading.Tasks.ValueTask<Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition?> FindByIdAsync(string tenantId, System.Threading.CancellationToken cancellationToken);
```
#### Parameters

###### `tenantId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByIdAsync(string,System.Threading.CancellationToken).tenantId}

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog.FindByIdAsync(string,System.Threading.CancellationToken).cancellationToken}

#### Returns
[System\.Threading\.Tasks\.ValueTask&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1 'System\.Threading\.Tasks\.ValueTask\`1')[TenantDefinition](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.TenantDefinition')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1 'System\.Threading\.Tasks\.ValueTask\`1')
