session
This commit is contained in:
parent
baea64229b
commit
0dc41337da
36 changed files with 324 additions and 95 deletions
21
Femto.Api/Sessions/HttpContextSessionExtensions.cs
Normal file
21
Femto.Api/Sessions/HttpContextSessionExtensions.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using Femto.Modules.Auth.Application.Dto;
|
||||
|
||||
namespace Femto.Api.Sessions;
|
||||
|
||||
internal static class HttpContextSessionExtensions
|
||||
{
|
||||
public static void SetSession(this HttpContext httpContext, Session session)
|
||||
{
|
||||
httpContext.Response.Cookies.Append(
|
||||
"session",
|
||||
session.SessionId,
|
||||
new CookieOptions
|
||||
{
|
||||
HttpOnly = true,
|
||||
Secure = true,
|
||||
SameSite = SameSiteMode.Strict,
|
||||
Expires = session.Expires,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue