Web:访问令牌 10 分钟;活跃时自动轮换刷新令牌;连续无操作 30 分钟后清除登录并跳转登录页。 App:会话窗口 3 天;打开 App、恢复前台或请求接口时自动刷新并重新顺延 3 天。 普通登录和 SSO 使用同一策略。 刷新令牌只以 SHA-256 摘要入库,每次刷新都会轮换,旧令牌无法再次使用;退出登录会吊销刷新令牌。 网络临时故障不会误清登录状态,多标签页同时刷新也做了竞争处理。
13 lines
450 B
C#
13 lines
450 B
C#
namespace Jiaowu.Api.Infrastructure.Auth;
|
|
|
|
public sealed class JwtOptions
|
|
{
|
|
public const string SectionName = "Jwt";
|
|
public string Issuer { get; set; } = "Jiaowu.Api";
|
|
public string Audience { get; set; } = "Jiaowu.Web";
|
|
public string Key { get; set; } = string.Empty;
|
|
public int AccessTokenMinutes { get; set; } = 10;
|
|
public int WebIdleMinutes { get; set; } = 30;
|
|
public int AppIdleMinutes { get; set; } = 3 * 24 * 60;
|
|
}
|