0

From validate-jwt policy reference https://learn.microsoft.com/en-us/azure/api-management/validate-jwt-policy

<issuer-signing-keys>     

<key>Base64 encoded signing key | certificate-id="mycertificate" | n="modulus" e="exponent</key>

</issuer-signing-keys>

It says, I can use mod(n) and exponent(e) to validate JWT. I tried it but it in inbound policy, but it says that it is not valid base64 string. How to use jwk having n and e parameters to validate JWT?

When I convert JWT into public key(from external source) and save it to named value. Policy is getting saved but not saving while using n and e parameters of JWK. If there is way to convert JWK to base64 string in APIM, that will also work.

Inbound policy:

<validate-jwt header-name="Authorization" failed-validation httpcode="401" failed-validation-error-message="Unauthorized">
<issuer-signing-keys>
     <key> n = {{n}} e = {{e}}</key>
</issuer-signing-keys>
</validate-jwt>

Update: The policy works only when I put modulus(n) and exponent(e) as constant OR save constants in named value and then use them like below

<key n = "{{n}}" e = "{{e}}"/>

But I need to extract n, e from another header and then validate JWT. Is it possible using jwt-validate? Like below,

<issuer-signing-keys>
   <key n= "@(Context.variables["mod"])" e= "@(Context.variables["exponent"])" />
</issuer-signing-keys>
Abhishek
  • 13
  • 4

0 Answers0