小编erP*_*rPe的帖子

在 AWS Athena 中查询嵌套 JSON 结构

我得到了以下格式的具有嵌套结构的 JSON 文档

{
    "id": "p-1234-2132321-213213213-12312",
    "name": "athena to the rescue",
    "groups": [
        {
            "strategy_group": "anyOf",
            "conditions": [
                {
                    "strategy_conditions": "anyOf",
                    "entries": [
                        {
                            "c_key": "service",
                            "C_operation": "isOneOf",
                            "C_value": "mambo,bambo,jumbo"
                        },
                        {
                            "c_key": "hostname",
                            "C_operation": "is",
                            "C_value": "lols"
                        }
                    ]
                }
            ]
        }
    ],
    "tags": [
        "aaa",
        "bbb",
        "ccc"
    ]
}
Run Code Online (Sandbox Code Playgroud)

我在 Athena 中创建了表来支持它,使用以下内容

CREATE EXTERNAL TABLE IF NOT EXISTS filters ( id string, name string, tags array<string>, groups array<struct<
    strategy_group:string,
    conditions:array<struct<
        strategy_conditions:string,
        entries: array<struct<
            c_key:string,
            c_operation:string,
            c_value:string
        >>
    >> …
Run Code Online (Sandbox Code Playgroud)

presto amazon-athena

5
推荐指数
1
解决办法
2万
查看次数

带有OWIN的webapi中的复杂JSON Web令牌数组

我正在努力学习JWT和ouath.我遇到过JWT的形式,它可以帮助我开发我的授权服务器.

我遇到的格式如下:

{
  iat: 1416929061, 
  jti: "802057ff9b5b4eb7fbb8856b6eb2cc5b",
  scopes: {
    users: {
      actions: ['read', 'create']
    },
    users_app_metadata: {
      actions: ['read', 'create']
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,因为在添加声明时我们只能添加简单的字符串,这样可以实现这样的事情吗?

我到目前为止看到的唯一方法是使用JSON.serialization - 来自/sf/answers/1909558031/

new Claim(someClass,JsonConvert.SerializeObject(result)
Run Code Online (Sandbox Code Playgroud)

任何准则将不胜感激!谢谢!

用于测试的代码

我想在JWT中使用

public class MyTes
{
    public string       area { get; set; }
    public List<string> areapermissions { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

然后我使用以下代码生成令牌

        var identity = new ClaimsIdentity("JWT");

        var cos = new List<string>();

        cos.Add("aaa");
        cos.Add("bbb");

        MyTes vario = new MyTes()
        {
            area = "someregion",
            areapermissions = cos
        };




        identity.AddClaim(new Claim(ClaimTypes.Name, …
Run Code Online (Sandbox Code Playgroud)

c# oauth-2.0 jwt asp.net-web-api asp.net-web-api2

4
推荐指数
2
解决办法
6335
查看次数