Using thinktecture JWT authentication resource owner flow,i use the claims part of JWT for client consumption. My question is that if its possible to add claim in identity server and decode it as an array in client.
There is no ClaimTypeValues for array type.
As a workaround:
var user = IdentityServerPrincipal.Create(response.UserName, response.UserName);
user.Identities.First()
.AddClaims(
new List<Claim>()
{
new Claim(ClaimTypes.Name, response.UserName),
new Claim(ClaimTypes.Email, response.Email),
new Claim(FullName, response.FullName),
new Claim(AuthorizedCompanies,JsonConvert.SerializeObject(response.AuthorizedCompanies))
});
return new AuthenticateResult(user);
I add claim as json array to claim for AuthorizedCompanies and parse it in client side.What is the design pattern here if any ?