wip session auth
This commit is contained in:
parent
aa4394fd21
commit
7b6c155a73
23 changed files with 321 additions and 90 deletions
|
@ -8,14 +8,14 @@ namespace Femto.Api.Sessions;
|
|||
|
||||
internal static class HttpContextSessionExtensions
|
||||
{
|
||||
public static void SetSession(this HttpContext httpContext, Session session, UserInfo user, ILogger logger)
|
||||
public static void SetSession(this HttpContext httpContext, SessionDto sessionDto, UserInfo user, ILogger logger)
|
||||
{
|
||||
var cookieSettings = httpContext.RequestServices.GetService<IOptions<CookieSettings>>();
|
||||
|
||||
var secure = cookieSettings?.Value.Secure ?? true;
|
||||
var sameSite = cookieSettings?.Value.SameSite ?? SameSiteMode.Strict;
|
||||
var domain = cookieSettings?.Value.Domain;
|
||||
var expires = session.Expires;
|
||||
var expires = sessionDto.Expires;
|
||||
|
||||
logger.LogInformation(
|
||||
"cookie settings: Secure={Secure}, SameSite={SameSite}, domain={Domain}, Expires={Expires}",
|
||||
|
@ -27,7 +27,7 @@ internal static class HttpContextSessionExtensions
|
|||
|
||||
httpContext.Response.Cookies.Append(
|
||||
"session",
|
||||
session.SessionId,
|
||||
sessionDto.SessionId,
|
||||
new CookieOptions
|
||||
{
|
||||
IsEssential = true,
|
||||
|
@ -55,7 +55,7 @@ internal static class HttpContextSessionExtensions
|
|||
IsEssential = true,
|
||||
Secure = secure,
|
||||
SameSite = sameSite,
|
||||
Expires = session.Expires,
|
||||
Expires = sessionDto.Expires,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue