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

## SessionManagementService Class

Implements session management functionality in accordance with OpenID Connect session management standards\.
This service is responsible for managing browser sessions by utilizing cookies and providing mechanisms
to check and maintain the session state between the client and the server\.

```csharp
public class SessionManagementService : Abblix.Oidc.Server.Features.SessionManagement.ISessionManagementService
```

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

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

## SessionManagementService\(IOptionsSnapshot\<OidcOptions\>, IRequestInfoProvider\) Constructor {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.SessionManagementService(Microsoft.Extensions.Options.IOptionsSnapshot_Abblix.Oidc.Server.Common.Configuration.OidcOptions_,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider)}

Implements session management functionality in accordance with OpenID Connect session management standards\.
This service is responsible for managing browser sessions by utilizing cookies and providing mechanisms
to check and maintain the session state between the client and the server\.

```csharp
public SessionManagementService(Microsoft.Extensions.Options.IOptionsSnapshot<Abblix.Oidc.Server.Common.Configuration.OidcOptions> options, Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider requestInfoProvider);
```
#### Parameters

###### `options` [Microsoft\.Extensions\.Options\.IOptionsSnapshot&lt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptionssnapshot-1 'Microsoft\.Extensions\.Options\.IOptionsSnapshot\`1')[OidcOptions](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Configuration.OidcOptions 'Abblix\.Oidc\.Server\.Common\.Configuration\.OidcOptions')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptionssnapshot-1 'Microsoft\.Extensions\.Options\.IOptionsSnapshot\`1') {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.SessionManagementService(Microsoft.Extensions.Options.IOptionsSnapshot_Abblix.Oidc.Server.Common.Configuration.OidcOptions_,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider).options}

The options for configuring the OpenID Connect session management service\.

###### `requestInfoProvider` [IRequestInfoProvider](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IRequestInfoProvider') {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.SessionManagementService(Microsoft.Extensions.Options.IOptionsSnapshot_Abblix.Oidc.Server.Common.Configuration.OidcOptions_,Abblix.Oidc.Server.Common.Interfaces.IRequestInfoProvider).requestInfoProvider}

The provider for accessing request\-related information, such as whether
            the current request is over HTTPS and the request's base path\.
### Properties

## SessionManagementService\.Enabled Property {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.Enabled}

Indicates whether session management functionality is enabled based on the configured endpoints\.

```csharp
public bool Enabled { get; }
```

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

#### Property Value
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')
### Methods

## SessionManagementService\.GetCheckSessionResponseAsync\(\) Method {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.GetCheckSessionResponseAsync()}

Asynchronously generates the response content for the check session endpoint\. This method retrieves an HTML template
that includes JavaScript code for the client to check the session state\.

```csharp
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Endpoints.CheckSession.Interfaces.CheckSessionResponse> GetCheckSessionResponseAsync();
```

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

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[CheckSessionResponse](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.CheckSession.Interfaces.CheckSessionResponse 'Abblix\.Oidc\.Server\.Endpoints\.CheckSession\.Interfaces\.CheckSessionResponse')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns a [CheckSessionResponse](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.CheckSession.Interfaces.CheckSessionResponse 'Abblix\.Oidc\.Server\.Endpoints\.CheckSession\.Interfaces\.CheckSessionResponse')
            containing the HTML content for the check session iframe and the name of the session management cookie\.

## SessionManagementService\.GetSessionCookie\(\) Method {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.GetSessionCookie()}

Retrieves a cookie configured for session management\. This cookie can be used to track the session state
between the client and the server\.

```csharp
public Abblix.Oidc.Server.Common.Cookie GetSessionCookie();
```

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

#### Returns
[Cookie](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Cookie 'Abblix\.Oidc\.Server\.Common\.Cookie')  
A [Cookie](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Cookie 'Abblix\.Oidc\.Server\.Common\.Cookie') object configured with session management settings, such as the cookie name,
            domain, path, and security attributes\.

### Remarks
Cookie attributes are configured for OpenID Connect Session Management compliance:
- `HttpOnly = false` - Required for check_session_iframe JavaScript to read the cookie
- `SameSite = None` - Required for cross-origin iframe access in Session Management
- `Secure` - Set based on the current request's HTTPS status (required when SameSite=None)

## SessionManagementService\.GetSessionState\(AuthorizationRequest, string\) Method {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.GetSessionState(Abblix.Oidc.Server.Model.AuthorizationRequest,string)}

Generates a session state string for an authorization request\. This string can be used by the client to
validate the session state\.

```csharp
public string GetSessionState(Abblix.Oidc.Server.Model.AuthorizationRequest request, string sessionId);
```
#### Parameters

###### `request` [AuthorizationRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Model.AuthorizationRequest 'Abblix\.Oidc\.Server\.Model\.AuthorizationRequest') {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.GetSessionState(Abblix.Oidc.Server.Model.AuthorizationRequest,string).request}

The authorization request containing client and redirect URI information\.

###### `sessionId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.SessionManagement.SessionManagementService.GetSessionState(Abblix.Oidc.Server.Model.AuthorizationRequest,string).sessionId}

A unique identifier for the session\.

Implements [GetSessionState\(AuthorizationRequest, string\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.SessionManagement.ISessionManagementService#Abblix.Oidc.Server.Features.SessionManagement.ISessionManagementService.GetSessionState(Abblix.Oidc.Server.Model.AuthorizationRequest,string) 'Abblix\.Oidc\.Server\.Features\.SessionManagement\.ISessionManagementService\.GetSessionState\(Abblix\.Oidc\.Server\.Model\.AuthorizationRequest, string\)')

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')  
A session state string composed of the client ID, origin, session ID, and a salt value, hashed for security\.
