All notebooks
GraphQL Access Control
Enable access control for resource access in GraphQL queries
12 cells · updated Feb 17, 2025
This is a read-only view. Responses shown were saved when the notebook was published —
open it in your own Aidbox to run the cells against live data.
Configuration
To enable GraphQL Access Control define the following environment variable:
BOX_FEATURES_GRAPHQL_ACCESS__CONTROL=rest-search
- The rest-search option imitates Search queries for the Access Control module when GraphQL queries are run.
- The disabled option disables Access Control for the resource lookups in GraphQl queries so only the access to the endpoint is verified.
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Client/my-client
Content-Type: text/yaml
Accept: text/yaml
secret: secret
grant_types:
- basic
Response:
Body
Status:
201
id: my-client
secret: __sha256:2BB80D537B1DA3E38BD30361AA855686BDE0EACD7162FEF6A25FE97BF527A25B
grant_types: [basic]
resourceType: Client
meta: {lastUpdated: '2025-02-17T16:15:37.049983Z', createdAt: '2025-02-17T16:15:37.049983Z', versionId: '572'}
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /AccessPolicy/my-client-allow-graphql
Content-Type: text/yaml
Accept: text/yaml
link:
- id: my-client
resourceType: Client
engine: matcho
matcho:
request-method: post
uri: /$graphql
Response:
Body
Status:
201
id: my-client-allow-graphql
link:
- {id: my-client, resourceType: Client}
engine: matcho
matcho: {uri: /$graphql, request-method: post}
resourceType: AccessPolicy
meta: {lastUpdated: '2025-02-17T16:15:51.742748Z', createdAt: '2025-02-17T16:15:51.742748Z', versionId: '573'}
REST
Send
Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /AccessPolicy/my-client-allow-patient
Content-Type: text/yaml
Accept: text/yaml
link:
- id: my-client
resourceType: Client
engine: matcho
matcho:
request-method: get
uri: /Patient
Response:
Body
Status:
200
id: my-client-allow-patient
link:
- {id: my-client, resourceType: Client}
engine: matcho
matcho: {uri: /Patient, request-method: get}
resourceType: AccessPolicy
meta: {lastUpdated: '2025-02-17T16:19:06.835640Z', createdAt: '2025-02-17T16:16:07.469608Z', versionId: '575'}
curl -s -X 'GET' -H 'Accept:text/yaml' -H 'Content-Type:text/yaml' -H 'Authorization:Basic bXktY2xpZW50OnNlY3JldA==' 'http://<base-url>/Patient?_count=1&_elements=id&_result=array'
curl -s -X 'POST' --data '{"query":"{PatientList(_count: 1) {id}}"}' -H 'Authorization:Basic bXktY2xpZW50OnNlY3JldA==' -H 'content-type:application/json' 'http://<base-url>/$graphql'
curl -s -X 'GET' -H 'Accept:text/yaml' -H 'Content-Type:text/yaml' -H 'Authorization:Basic bXktY2xpZW50OnNlY3JldA==' 'http://<base-url>/fhir/Observation?_count=1&_elements=id&_result=array'
curl -s -X 'POST' --data '{"query":"{ObservationList(_count: 1) {id}}"}' -H 'Authorization:Basic bXktY2xpZW50OnNlY3JldA==' -H 'content-type:application/json' 'http://<base-url>/$graphql'