I assume you ask asking for the caching duration.
The class that is in charge of the caching of the JWKS data is the ConfigurationManager class and You can find the source code for the class here.
The default caching time is 24 hours.
To set it in your API, you can control it in .NET 5 using:
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(opt =>
{
...
//set refresh interval to 1 hour
opt.AutomaticRefreshInterval = new TimeSpan(1, 0, 0);
});
Before .NET 5 this was readonly, but they made it editable in .NET 5.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…