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

## ISessionClientRegistry Interface

Records which clients signed in to an authentication session, so the clients can be told when it ends\.

```csharp
public interface ISessionClientRegistry
```

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

### Remarks
Kept on the server rather than in the session\. A session travels in the user's cookie, and a browser that
authorizes two clients at once sends both requests with the same cookie, so a list inside it can only
ever hold the client of whichever response arrived last\.

Replace the default when the backing store offers an atomic set addition across nodes. The default claims
one storage key per client through [TrySetIfAbsentAsync&lt;T&gt;\(string, T, StorageOptions, Nullable&lt;CancellationToken&gt;\)](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Storages.IEntityStorage#Abblix.Oidc.Server.Features.Storages.IEntityStorage.TrySetIfAbsentAsync_T_(string,T,Abblix.Oidc.Server.Features.Storages.StorageOptions,System.Nullable_System.Threading.CancellationToken_) 'Abblix\.Oidc\.Server\.Features\.Storages\.IEntityStorage\.TrySetIfAbsentAsync\<T\>\(string, T, Abblix\.Oidc\.Server\.Features\.Storages\.StorageOptions, System\.Nullable\<System\.Threading\.CancellationToken\>\)'), so between
concurrent authorizations it is as exact as the storage's implementation of that call. It also relies on the
storage keeping an entry until its expiry: an entry dropped earlier ends the list a logout reads at that
point.
### Methods

## ISessionClientRegistry\.AddClientAsync\(TenantDefinition, string, string, CancellationToken\) Method {#Abblix.Oidc.Server.Features.Storages.ISessionClientRegistry.AddClientAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition,string,string,System.Threading.CancellationToken)}

Records that a client signed in to a session, and keeps the clients recorded for the session readable for
at least [SessionClientsRetention](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Configuration.OidcOptions#Abblix.Oidc.Server.Common.Configuration.OidcOptions.SessionClientsRetention 'Abblix\.Oidc\.Server\.Common\.Configuration\.OidcOptions\.SessionClientsRetention') from now\. Recording a
client already recorded lists it no second time\.

```csharp
System.Threading.Tasks.Task AddClientAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant, string sessionId, string clientId, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `tenant` [TenantDefinition](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.TenantDefinition') {#Abblix.Oidc.Server.Features.Storages.ISessionClientRegistry.AddClientAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition,string,string,System.Threading.CancellationToken).tenant}

The tenant the session belongs to\.

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

The session the client signed in to\.

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

The client\.

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

Cancels the operation\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')

### Remarks
A session goes on under its id when its end user signs in again, so an implementation that let the list
expire a fixed time after its first client would end a long session without telling the clients that
signed in to it early\.

## ISessionClientRegistry\.GetClientsAsync\(TenantDefinition, string, CancellationToken\) Method {#Abblix.Oidc.Server.Features.Storages.ISessionClientRegistry.GetClientsAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition,string,System.Threading.CancellationToken)}

The clients recorded for a session, each once\.

```csharp
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<string>> GetClientsAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant, string sessionId, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `tenant` [TenantDefinition](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.TenantDefinition') {#Abblix.Oidc.Server.Features.Storages.ISessionClientRegistry.GetClientsAsync(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition,string,System.Threading.CancellationToken).tenant}

The tenant the session belongs to\.

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

The session\.

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

Cancels the lookup\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.Collections\.Generic\.IReadOnlyCollection&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1 'System\.Collections\.Generic\.IReadOnlyCollection\`1')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1 'System\.Collections\.Generic\.IReadOnlyCollection\`1')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
The recorded client identifiers; empty when none are recorded or the records have expired\.
