Use case
You have groups and user attributes configured in Cube Cloud. Now you want to query Core Data APIs directly (e.g., the SQL API) while still having your data access policies enforced based on those groups and attributes. By wrapping groups and user attributes inside thecubeCloud property of
your JWT payload, the API request is treated the same as a request from an
authenticated Cube Cloud user.
Configuration
JWT payload
Include acubeCloud object in the JWT payload with groups and, optionally,
userAttributes:
groupsis an array of group names the user belongs to.userAttributesis an object whose keys match the attribute names you defined in Cube Cloud.
Data access policy
In your data model, referencegroups and userAttributes as usual.
Because the cubeCloud wrapper maps them automatically, the same policy
works for both Cube Cloud UI users and direct API callers.
Example
The following Node.js script signs a JWT withcubeCloud groups and user
attributes, then queries the SQL API:
Result
Because the JWT containscubeCloud.groups: ["marketing"] and
cubeCloud.userAttributes.country: "United States", the query is filtered
by the marketing group’s access policy. Only rows matching the user
attribute filter are returned: