Merge pull request #3471 from PfaffIC/dev-loginauthcookie

Added auth cookie expiration for external login via OAuth2.
This commit is contained in:
Shaun Walker 2023-11-29 13:22:39 -05:00 committed by GitHub
commit 65f463dbbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,6 +239,14 @@ namespace Oqtane.Extensions
// pass properties to OnTicketReceived
context.Properties.SetParameter("status", identity.Label);
context.Properties.SetParameter("redirecturl", context.Properties.RedirectUri);
// set cookie expiration
string cookieExpStr = context.HttpContext.GetSiteSettings().GetValue("LoginOptions:CookieExpiration", "");
if (!string.IsNullOrEmpty(cookieExpStr) && TimeSpan.TryParse(cookieExpStr, out TimeSpan cookieExpTS))
{
context.Properties.ExpiresUtc = DateTime.Now.Add(cookieExpTS);
context.Properties.IsPersistent = true;
}
}
private static Task OnTicketReceived(TicketReceivedContext context)