I am using docker image tykio/tyk-gateway:v5.0.0 and testing the graphql policies config. I would like to create 2 policies article-admin-policy
and publisher-admin-policy
for accessing the UDG queries
type Query {
articles: [Article!]!
publishers: [Publisher!]!
}
accordingly.
I am using jwt “scope_to_policy” in api def json and here’s the policy json:
{
"article-admin-policy": {
"id": "article-admin-policy",
"rate": 1000,
"per": 1,
"quota_max": 100,
"quota_renewal_rate": 60,
"max_query_depth": 5,
"access_rights": {
"a16771d0-b43a-4469-a241-2a6fec0bfa0f": {
"api_id": "a16771d0-b43a-4469-a241-2a6fec0bfa0f",
"versions": [
"Default"
],
"allowed_types": [
{
"name": "Query",
"fields": ["articles"]
},
{
"name": "Article",
"fields": ["*"]
}
],
"restricted_types": []
}
},
"org_id": "org",
"hmac_enabled": false,
"active": true
},
"publisher-admin-policy": {
"id": "publisher-admin-policy",
"rate": 1000,
"per": 1,
"quota_max": 100,
"quota_renewal_rate": 60,
"max_query_depth": 5,
"access_rights": {
"a16771d0-b43a-4469-a241-2a6fec0bfa0f": {
"api_id": "a16771d0-b43a-4469-a241-2a6fec0bfa0f",
"versions": [
"Default"
],
"allowed_types": [
{
"name": "Query",
"fields": ["publishers"]
},
{
"name": "Publisher",
"fields": ["*"]
}
],
"restricted_types": []
}
},
"org_id": "org",
"hmac_enabled": false,
"active": true
}
}
Expected Result:
when a user have both scopes, both of the queries can be access.
Actual Result:
when a user have either one scope of both scopes, none of the query can be access.
field: publishers is restricted on type: Query
field: articles is restricted on type: Query
If I merge both policy into a single policy with all allowed_types configuration, it works. Am I missing some configuration or using an outdated docker image?