7
使用思維JWT認證資源所有者流程,我使用JWT的聲明部分來進行客戶端消費。 我的問題是,如果它有可能在身份服務器中添加聲明並將其解碼爲客戶端中的數組。向數組添加聲明給JWT?
數組類型沒有ClaimTypeValues。
作爲一種變通方法,
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);
我添加權利要求作爲JSON數組權利要求爲AuthorizedCompanies和在客戶端side.What解析它是設計圖案這裏如果有的話?