#### [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')

## TenantReplayCache Class

Keeps the identifiers of each tenant's single\-use tokens \- client assertions, DPoP proofs, bearer grants \- in a
space of its own\.

```csharp
public sealed class TenantReplayCache : Abblix.Jwt.ReplayPrevention.IReplayCache
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → TenantReplayCache

Implements [IReplayCache](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ReplayPrevention.IReplayCache 'Abblix\.Jwt\.ReplayPrevention\.IReplayCache')

### Remarks

The identifier is chosen by the client, so two tenants' clients can present the same one, and without this
the first tenant to see it would refuse the other's genuine token as a replay.

A reservation made outside any tenant keeps to the shared space rather than being refused, unlike stored
entities: this cache is shared with the receivers of security event tokens a host may run beside the server,
which work outside any tenant, and every tenant's reservation lies in its own space, so the two never meet.
### Constructors

## TenantReplayCache\(IReplayCache, ITenantAccessor\) Constructor {#Abblix.Oidc.Server.Features.MultiTenancy.TenantReplayCache.TenantReplayCache(Abblix.Jwt.ReplayPrevention.IReplayCache,Abblix.Oidc.Server.Features.MultiTenancy.ITenantAccessor)}

Keeps the identifiers of each tenant's single\-use tokens \- client assertions, DPoP proofs, bearer grants \- in a
space of its own\.

```csharp
public TenantReplayCache(Abblix.Jwt.ReplayPrevention.IReplayCache inner, Abblix.Oidc.Server.Features.MultiTenancy.ITenantAccessor tenantAccessor);
```
#### Parameters

###### `inner` [IReplayCache](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ReplayPrevention.IReplayCache 'Abblix\.Jwt\.ReplayPrevention\.IReplayCache') {#Abblix.Oidc.Server.Features.MultiTenancy.TenantReplayCache.TenantReplayCache(Abblix.Jwt.ReplayPrevention.IReplayCache,Abblix.Oidc.Server.Features.MultiTenancy.ITenantAccessor).inner}

###### `tenantAccessor` [ITenantAccessor](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.MultiTenancy.ITenantAccessor 'Abblix\.Oidc\.Server\.Features\.MultiTenancy\.ITenantAccessor') {#Abblix.Oidc.Server.Features.MultiTenancy.TenantReplayCache.TenantReplayCache(Abblix.Jwt.ReplayPrevention.IReplayCache,Abblix.Oidc.Server.Features.MultiTenancy.ITenantAccessor).tenantAccessor}

### Remarks

The identifier is chosen by the client, so two tenants' clients can present the same one, and without this
the first tenant to see it would refuse the other's genuine token as a replay.

A reservation made outside any tenant keeps to the shared space rather than being refused, unlike stored
entities: this cache is shared with the receivers of security event tokens a host may run beside the server,
which work outside any tenant, and every tenant's reservation lies in its own space, so the two never meet.
### Methods

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

Gives back a reservation, so the same identifier reads as fresh again\.

```csharp
public System.Threading.Tasks.Task ReleaseAsync(string identifier, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

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

The value that was reserved\.

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

Cancels the cache round trip\.

Implements [ReleaseAsync\(string, CancellationToken\)](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ReplayPrevention.IReplayCache#Abblix.Jwt.ReplayPrevention.IReplayCache.ReleaseAsync(string,System.Threading.CancellationToken) 'Abblix\.Jwt\.ReplayPrevention\.IReplayCache\.ReleaseAsync\(System\.String,System\.Threading\.CancellationToken\)')

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

### Remarks
For the caller whose own [TryReserveAsync\(string, DateTimeOffset, CancellationToken\)](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ReplayPrevention.IReplayCache#Abblix.Jwt.ReplayPrevention.IReplayCache.TryReserveAsync(string,System.DateTimeOffset,System.Threading.CancellationToken) 'Abblix\.Jwt\.ReplayPrevention\.IReplayCache\.TryReserveAsync\(System\.String,System\.DateTimeOffset,System\.Threading\.CancellationToken\)') answered true and whose work on that
token then failed: without it a retry of the token is refused as a replay of work that never
happened\. Any other caller that releases an identifier opens it to replay\.

## TenantReplayCache\.TryReserveAsync\(string, DateTimeOffset, CancellationToken\) Method {#Abblix.Oidc.Server.Features.MultiTenancy.TenantReplayCache.TryReserveAsync(string,System.DateTimeOffset,System.Threading.CancellationToken)}

Reserves an identifier, answering whether this is its first sighting\.

```csharp
public System.Threading.Tasks.Task<bool> TryReserveAsync(string identifier, System.DateTimeOffset expiresAt, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

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

What identifies the token\. A profile whose identifier is unique only within a scope
composes that scope into the value it passes \- a SET's "jti" is unique per event feed
\(RFC 8417 Section 2\.2\), so its receiver reserves the issuer and the identifier together\.

###### `expiresAt` [System\.DateTimeOffset](https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset 'System\.DateTimeOffset') {#Abblix.Oidc.Server.Features.MultiTenancy.TenantReplayCache.TryReserveAsync(string,System.DateTimeOffset,System.Threading.CancellationToken).expiresAt}

When the identifier stops being worth remembering, which is the last moment a replay of
this token could still pass the caller's own freshness checks\. Forgetting earlier would
let that token replay; the implementation is free to remember longer\.

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

Cancels the cache round trip\.

Implements [TryReserveAsync\(string, DateTimeOffset, CancellationToken\)](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ReplayPrevention.IReplayCache#Abblix.Jwt.ReplayPrevention.IReplayCache.TryReserveAsync(string,System.DateTimeOffset,System.Threading.CancellationToken) 'Abblix\.Jwt\.ReplayPrevention\.IReplayCache\.TryReserveAsync\(System\.String,System\.DateTimeOffset,System\.Threading\.CancellationToken\)')

#### 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\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
True when the identifier was newly reserved and the token is therefore fresh; false when
it was already there, which is a replay\.
