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

## IAuthSessionService Interface

Manages user authentication, providing mechanisms to sign in, sign out, and maintain user sessions\.
This interface plays a pivotal role in the security and session management of an application, ensuring that users are
authenticated and their sessions are managed securely across different contexts and client applications\.

```csharp
public interface IAuthSessionService
```
### Methods

## IAuthSessionService\.AuthenticateAsync\(\) Method {#Abblix.Oidc.Server.Features.UserAuthentication.IAuthSessionService.AuthenticateAsync()}

Authenticates the current user based on the session context, verifying their identity and session validity\.
This method is crucial for ensuring that requests are made by an authenticated user and for retrieving the user's session information\.

```csharp
System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.UserAuthentication.AuthSession?> AuthenticateAsync();
```

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that resolves to an [AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession') representing the authenticated user's session, or null if no valid session exists\.

## IAuthSessionService\.GetAvailableAuthSessions\(\) Method {#Abblix.Oidc.Server.Features.UserAuthentication.IAuthSessionService.GetAvailableAuthSessions()}

Retrieves currently active authentication sessions for the user\.
This method is typically used to display all sessions that a user has, allowing them to manage their sessions\.

```csharp
System.Collections.Generic.IAsyncEnumerable<Abblix.Oidc.Server.Features.UserAuthentication.AuthSession> GetAvailableAuthSessions();
```

#### Returns
[System\.Collections\.Generic\.IAsyncEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1 'System\.Collections\.Generic\.IAsyncEnumerable\`1')[AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1 'System\.Collections\.Generic\.IAsyncEnumerable\`1')  
An asynchronous stream of [AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession') instances, each representing an active user session\.

## IAuthSessionService\.SignInAsync\(AuthSession\) Method {#Abblix.Oidc.Server.Features.UserAuthentication.IAuthSessionService.SignInAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession)}

Initiates a new user session based on provided user claims, effectively signing in the user\.
This method is essential for establishing new user sessions following successful authentication\.

```csharp
System.Threading.Tasks.Task SignInAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession authSession);
```
#### Parameters

###### `authSession` [AuthSession](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.UserAuthentication.AuthSession 'Abblix\.Oidc\.Server\.Features\.UserAuthentication\.AuthSession') {#Abblix.Oidc.Server.Features.UserAuthentication.IAuthSessionService.SignInAsync(Abblix.Oidc.Server.Features.UserAuthentication.AuthSession).authSession}

Detailed information about the authentication session to be established\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')  
A task that signifies the completion of the user sign\-in process\.

## IAuthSessionService\.SignOutAsync\(\) Method {#Abblix.Oidc.Server.Features.UserAuthentication.IAuthSessionService.SignOutAsync()}

Terminates the current user session, effectively signing out the user\.
This method is crucial for maintaining the security of the application by ensuring that user sessions can be properly closed\.

```csharp
System.Threading.Tasks.Task SignOutAsync();
```

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')  
A task that signifies the completion of the user sign\-out process\.
