B2C Web应用程序会话生命周期

时间:2017-04-14 18:04:03

标签: azure asp.net-core azure-ad-b2c

我正在使用B2C门户分配以下值。我假设web app session lifetime设置会有效地设置cookie过期。但无论我做什么,它都会在两周中继续回归。 (今天是14日)。

enter image description here enter image description here

如果我使用TicketReceived事件设置context.Properties.ExpiresUtc,则我设置的值会显示在Cookie中。

如果web app session lifetime不应该设置cookie,那么它有什么用?无论如何,我无法弄清楚两周的来源。

据我所知,令牌生命周期中的以下值会在回复时设置exp声明。这似乎只适用于JWT。

enter image description here

有人可以对此有所了解吗?

TIA

1 个答案:

答案 0 :(得分:6)

很久以前我也在努力解决这个问题,这是我的看法:

Web app session timeout用于B2C的cookie,因此如果您登录第二个B2C安全应用程序,则无需在B2C重新登录。这不是您要寻找的价值。

应将令牌生存期复制到您自己的环境中。 查看有关UseTokenLifetime

的一些文档

此处也可以阅读:

https://github.com/aspnet/Security/issues/147

  

我们认为默认值为true总体上是最安全的:   使用ASP.NET Identity时,它将使用自己的cookie替换cookie,该cookie具有自己的过期规则   当使用OIDC是主要身份验证时,true的值可能是人们想要的。

以及更多信息: Microsoft.Owin.Security.OpenIdConnect with Azure Active Directory authentication ticket lifetime

代码片段:

 app.UseOpenIdConnectAuthentication(
   new OpenIdConnectAuthenticationOptions
   {
       ....
       UseTokenLifetime = true,
       ....
相关问题