OpenID Connect discovery documents typically include a jwks_uri property. The data returned from the jwks_uri seems to take on at least two different forms. One form contains fields called x5c and x5t. An example of this looks like:
{
"keys": [
{
"kty": "RSA",
"use": "sig",
"kid": "C61F8F2524D080D0DB0A508747A94C2161DEDAC8",
"x5t": "xh-PJSTQgNDbClCHR6lMIWHe2sg", <------ HERE
"e": "AQAB",
"n": "lueb...",
"x5c": [
"MIIC/..." <------ HERE
],
"alg": "RS256"
}
]
}
The other version that I see omits the x5c and x5t properties but contains e and n. An example of this is:
{
"keys": [
{
"kty": "RSA",
"alg": "RS256",
"use": "sig",
"kid": "cb11e2f233aee0329a5344570349cddb6b8ff252",
"n": "sJ46h...", <------ HERE
"e": "AQAB" <------ HERE
}
]
}
I am using C#'s Microsoft.IdentityModel.Tokens.TokenValidationParameters and I am trying to figure out how to supply the property IssuerSigningKey. A sample usage of this class is
new TokenValidationParameters
{
ValidateAudience = true,
ValidateIssuer = true,
...,
IssuerSigningKey = new X509SecurityKey(???) or new JsonWebKey(???) //How to create this based on x5c/x5t and also how to create this based on e and n ?
}
Given these two different JWK formats, how do I use them to provide the IssuerSigningKey to the TokenValidationParameter so I can validate access tokens?