在令牌描述符中添加多个受众

Add multiple audiences in token descriptor

我有以下代码:

   var tokenDescriptor = new SecurityTokenDescriptor()
    {
        NotBefore = DateTime.UtcNow,
        Expires = DateTime.UtcNow.AddSeconds(client.AccessTokenLifetime),
        Issuer = issuer,
        Audience = (await _apiResourcesStore.FindByScopesNameAsync(tokenRequest.Scope.Split(" ").ToList())).Select(p => p.Name).ToArray(),
    }

我想添加多个受众,但受众类型是 string。有什么办法可以欺骗令牌描述符吗?或者可能有令牌描述符的替代方法?

我做到了,现在可以了:

var tokenDescriptor = new SecurityTokenDescriptor()
            {
                NotBefore = DateTime.UtcNow,
                Expires = DateTime.UtcNow.AddSeconds(client.AccessTokenLifetime),
                Issuer = issuer,
                Claims = new Dictionary<string, object>
                {
                    { JwtRegisteredClaimNames.Aud, (await _apiResourcesStore.FindByScopesNameAsync(tokenRequest.Scope.Split(" ").ToList())).Select(p => p.Name).ToArray() }
                }
            };

我刚刚添加了新声明。