v

    Viet Au

    1 month ago
    Hi, when talking directly to the Cerbos gRPC service, how do I represent the attributes for a principal and for a resource in JSON? I need this for testing the gRPC in Postman and K6. Trying to do similar to this example in the playground https://play.cerbos.dev/p/LXjgi62fb63c1QypYuZhsyRK3cTMcRx5 This is what I have but it does not work.
    {
    "requestId": "123123",
    "version": "default",
    "principal": {
    "id": "<mailto:email@email.com|email@email.com>",
    "roles": [
    "user"
    ],
    "attr": [
    {
    "key":"salesreps",
    "value": {
    "kind": {
    "listValue": ["1","2"]
    }
    }
    }
    ]
    },
    "resources": [
    {
    "resource": {
    "kind": "customer",
    "version": "default",
    "id": "12345",
    "scope": "teamb",
    "attr": [
    {
    "key":"salesrep",
    "value": {
    "kind": {
    "stringValue": "2"
    }
    }
    }
    ]
    },
    "actions": ["VIEW"]
    }
    ]
    }
    Alex Olivier (Cerbos)

    Alex Olivier (Cerbos)

    1 month ago
    The attrbuite field should just be a map eg
    "principal": {
        "id": "alice",
        "roles": ["employee"],
        "attr": {
          "department": "accounting",
          "geography": "GB",
          "team": "design"
        }
      },
    v

    Viet Au

    1 month ago
    ok let me try grpcurl, it could be a postman issue but it doesn't like it when I did this. It expects the attr to be an array.
    Alex Olivier (Cerbos)

    Alex Olivier (Cerbos)

    1 month ago
    Odd - let me us know how you get on
    v

    Viet Au

    1 month ago
    will do
    Alex Olivier (Cerbos)

    Alex Olivier (Cerbos)

    1 month ago
    The protobuf type is
    map<string, google.protobuf.Value>
    v

    Viet Au

    1 month ago
    grpc curl works, must be how postman did reflection on the grpc end point.