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

## InMemoryLongPollingService Class

In\-memory implementation of backchannel authentication status notifier using TaskCompletionSource\.
Suitable for single\-server deployments or development environments\.

```csharp
public class InMemoryLongPollingService : Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelLongPollingService
```

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

Implements [IBackChannelLongPollingService](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelLongPollingService 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.Interfaces\.IBackChannelLongPollingService')

### Remarks

This implementation uses an in-memory dictionary of TaskCompletionSource objects to coordinate
between authentication completion and waiting token requests. When authentication status changes,
all waiting tasks are signaled via TaskCompletionSource.SetResult().

<strong>Characteristics:</strong>
- Thread-safe using ConcurrentDictionary
- Automatic cleanup of completed waiters
- Supports multiple simultaneous waiters per auth_req_id
- Memory efficient (only stores active waiters)
- NOT suitable for multi-server deployments (notifications are local only)

<strong>For Multi-Server Deployments:</strong>

Use a distributed implementation based on Redis Pub/Sub, SignalR backplane, or message queue.
### Constructors

## InMemoryLongPollingService\(ILogger\<InMemoryLongPollingService\>\) Constructor {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.InMemoryLongPollingService(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService_)}

In\-memory implementation of backchannel authentication status notifier using TaskCompletionSource\.
Suitable for single\-server deployments or development environments\.

```csharp
public InMemoryLongPollingService(Microsoft.Extensions.Logging.ILogger<Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService> logger);
```
#### Parameters

###### `logger` [Microsoft\.Extensions\.Logging\.ILogger&lt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger-1 'Microsoft\.Extensions\.Logging\.ILogger\`1')[InMemoryLongPollingService](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.InMemoryLongPollingService')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger-1 'Microsoft\.Extensions\.Logging\.ILogger\`1') {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.InMemoryLongPollingService(Microsoft.Extensions.Logging.ILogger_Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService_).logger}

### Remarks

This implementation uses an in-memory dictionary of TaskCompletionSource objects to coordinate
between authentication completion and waiting token requests. When authentication status changes,
all waiting tasks are signaled via TaskCompletionSource.SetResult().

<strong>Characteristics:</strong>
- Thread-safe using ConcurrentDictionary
- Automatic cleanup of completed waiters
- Supports multiple simultaneous waiters per auth_req_id
- Memory efficient (only stores active waiters)
- NOT suitable for multi-server deployments (notifications are local only)

<strong>For Multi-Server Deployments:</strong>

Use a distributed implementation based on Redis Pub/Sub, SignalR backplane, or message queue.
### Methods

## InMemoryLongPollingService\.NotifyStatusChangeAsync\(string, BackChannelAuthenticationStatus\) Method {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.NotifyStatusChangeAsync(string,Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationStatus)}

Notifies all waiting requests that the authentication status has changed\.
Signals all TaskCompletionSource objects waiting for this auth\_req\_id\.

```csharp
public System.Threading.Tasks.Task NotifyStatusChangeAsync(string authenticationRequestId, Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationStatus newStatus);
```
#### Parameters

###### `authenticationRequestId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.NotifyStatusChangeAsync(string,Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationStatus).authenticationRequestId}

###### `newStatus` [BackChannelAuthenticationStatus](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationStatus 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.BackChannelAuthenticationStatus') {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.NotifyStatusChangeAsync(string,Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationStatus).newStatus}

Implements [NotifyStatusChangeAsync\(string, BackChannelAuthenticationStatus\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelLongPollingService#Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelLongPollingService.NotifyStatusChangeAsync(string,Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationStatus) 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.Interfaces\.IBackChannelLongPollingService\.NotifyStatusChangeAsync\(string, Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.BackChannelAuthenticationStatus\)')

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

## InMemoryLongPollingService\.WaitForStatusChangeAsync\(string, TimeSpan, CancellationToken\) Method {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.WaitForStatusChangeAsync(string,System.TimeSpan,System.Threading.CancellationToken)}

Waits for a status change notification for the specified authentication request\.
Uses TaskCompletionSource to efficiently wait without blocking threads\.

```csharp
public System.Threading.Tasks.Task<bool> WaitForStatusChangeAsync(string authenticationRequestId, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `authenticationRequestId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.WaitForStatusChangeAsync(string,System.TimeSpan,System.Threading.CancellationToken).authenticationRequestId}

###### `timeout` [System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan') {#Abblix.Oidc.Server.Features.BackChannelAuthentication.InMemoryLongPollingService.WaitForStatusChangeAsync(string,System.TimeSpan,System.Threading.CancellationToken).timeout}

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

Implements [WaitForStatusChangeAsync\(string, TimeSpan, CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelLongPollingService#Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelLongPollingService.WaitForStatusChangeAsync(string,System.TimeSpan,System.Threading.CancellationToken) 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.Interfaces\.IBackChannelLongPollingService\.WaitForStatusChangeAsync\(string, System\.TimeSpan, 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')
