ASP.NET Core 2.x has a really nice way to add Bearer Authentication using JWT tokens. The following code is the minimum requirement to make things work.
{
TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuer = "https://issuer.com",
ValidateLifetime = true,
}
});
I understand the anatomy of a JWT header.payload.signature
but in case we are using an Asymmetric algorithm, we need to validate the signature and for that we need to get the public keys from this url: issuer + .well-known/jwks.json
.
So, is the middleware "magically" fetching the public keys and validating the signature? Also, is the middleware caching the public keys to avoid fetching the public keys in every validation?
TokenValidationParameters
IssuerSigningKey property? – Jonathon ChaseIssuerSigningKeyResolver
my question is about the public keys caching. – Marco Talento