1

I have a list of claims in my object Dictionary inputClaims from which i am creating claim. One claim type is array but it is always initialized as string. Any idea how can i create Claim with Array type

Kamran Shahid
  • 3,954
  • 5
  • 48
  • 93
  • You'll need to serialize and deserialize the array into/from JSON string if you want to store it inside a claim... – Adrian Mar 10 '20 at 10:34
  • can you please provide related code ? – Ehsan Sajjad Mar 10 '20 at 10:34
  • JsonClaimValueTypes.Json did the trick. Related code is at https://stackoverflow.com/questions/60599339/any-way-to-create-a-jwt-token-with-key-size-512-and-changing-default-minimum-si – Kamran Shahid Mar 10 '20 at 10:48

1 Answers1

1

In the end I have found out that I have to use JsonClaimValueTypes.JsonArray

My Claim initialization looks like following

new Claim("amr", JsonSerializer.Serialize(new List<string> { "SIM_PIN" }), JsonClaimValueTypes.JsonArray)
Kamran Shahid
  • 3,954
  • 5
  • 48
  • 93