Authentication Asp.Net核心AddJWTBearrer JWKS的默认缓存?
我已经用基本设置配置了AddJwtBearer,授权是一个OpenID连接身份服务器。工作正常,但是JWKS URL的默认缓存实现是什么,它的超时,以及如何配置缓存超时Authentication Asp.Net核心AddJWTBearrer JWKS的默认缓存?,authentication,caching,.net-core,jwt,openid-connect,Authentication,Caching,.net Core,Jwt,Openid Connect,我已经用基本设置配置了AddJwtBearer,授权是一个OpenID连接身份服务器。工作正常,但是JWKS URL的默认缓存实现是什么,它的超时,以及如何配置缓存超时 services.AddAuthentication().AddJwtBearer(options => { options.Authority = Configuration["Authority"]; options.Audience = Configuration["Au
services.AddAuthentication().AddJwtBearer(options =>
{
options.Authority = Configuration["Authority"];
options.Audience = Configuration["Audience"];
});
我想你会问缓存的持续时间 负责JWKS数据缓存的类是ConfigurationManager类,您可以找到该类的源代码 默认缓存时间为24小时 要在API中设置它,可以在.NET 5中使用以下方法进行控制: services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(opt=> {
在.NET 5之前,这是只读的,但他们在.NET 5中使其可编辑。我想您会询问缓存持续时间 负责JWKS数据缓存的类是ConfigurationManager类,您可以找到该类的源代码 默认缓存时间为24小时 要在API中设置它,可以在.NET 5中使用以下方法进行控制: services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(opt=> { 在.NET5之前,这是只读的,但他们在.NET5中使其可编辑
//set refresh interval to 1 hour
opt.AutomaticRefreshInterval = new TimeSpan(1, 0, 0);
});