identityserver 在服务器重启时使用 aspnetidentity id_token
identityserver using aspnetidentity id_token on server reboot
我有带有 aspnetidentity 的 identityserver4,它正在工作,但在服务器重新启动时应用程序将用户重定向到再次签名。
services.AddIdentityServer(options =>
{
options.Events.RaiseSuccessEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseErrorEvents = true;
//options.Authentication.CookieLifetime = TimeSpan.FromSeconds(30);
options.Authentication.CookieLifetime = TimeSpan.FromMinutes(20);
}).AddSigningCredential(cert)
//.AddInMemoryIdentityResources(Config.GetIdentityResources())
//.AddInMemoryApiResources(Config.GetApiResources())
//.AddInMemoryClients(Config.GetClients())
//.AddTestUsers(Config.GetUsers());
.AddConfigurationStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddOperationalStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddAspNetIdentity<ApplicationUser>()
.AddProfileService<ProfileService>();
使用访问令牌我没有任何问题,因为它以 cookie 格式与客户端浏览器一起使用。无论服务器是否重新启动,资源仍然允许。
但 id_token 这是相同的情况,但是当请求转到 Idmsrv 端点时 connect/authorize 它会让用户再次登录。
将密钥保存到磁盘而不是内存中,因此当 cookie 返回服务器以使用密钥解密时它将有一个密钥。
//REFERENCE 保留键 http://www.tugberkugurlu.com/archive/asp-net-core-authentication-in-a-load-balanced-environment-with-haproxy-and-redis
services.AddDataProtection() //Microsoft.AspNetCore.DataProtection.Redis package
.PersistKeysToFileSystem(new DirectoryInfo("F:\Jana\Certs\Keys\"));
我有带有 aspnetidentity 的 identityserver4,它正在工作,但在服务器重新启动时应用程序将用户重定向到再次签名。
services.AddIdentityServer(options =>
{
options.Events.RaiseSuccessEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseErrorEvents = true;
//options.Authentication.CookieLifetime = TimeSpan.FromSeconds(30);
options.Authentication.CookieLifetime = TimeSpan.FromMinutes(20);
}).AddSigningCredential(cert)
//.AddInMemoryIdentityResources(Config.GetIdentityResources())
//.AddInMemoryApiResources(Config.GetApiResources())
//.AddInMemoryClients(Config.GetClients())
//.AddTestUsers(Config.GetUsers());
.AddConfigurationStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddOperationalStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddAspNetIdentity<ApplicationUser>()
.AddProfileService<ProfileService>();
使用访问令牌我没有任何问题,因为它以 cookie 格式与客户端浏览器一起使用。无论服务器是否重新启动,资源仍然允许。
但 id_token 这是相同的情况,但是当请求转到 Idmsrv 端点时 connect/authorize 它会让用户再次登录。
将密钥保存到磁盘而不是内存中,因此当 cookie 返回服务器以使用密钥解密时它将有一个密钥。
//REFERENCE 保留键 http://www.tugberkugurlu.com/archive/asp-net-core-authentication-in-a-load-balanced-environment-with-haproxy-and-redis
services.AddDataProtection() //Microsoft.AspNetCore.DataProtection.Redis package
.PersistKeysToFileSystem(new DirectoryInfo("F:\Jana\Certs\Keys\"));