Server-side proxy for the Cube.js /load endpoint, packaged as a small Django/DRF application. The proxy signs an HS256 JWT per request with an identity value (e.g. a tenant UUID, an organisation id, a project id …) resolved from the authenticated user, so the Cube.js secret never reaches the browser.
Setup
1. Install with pip:
pip install ngits-drf-cube-proxy (or ``pip install "ngits-drf-cube-proxy[schemas]"`` for the drf-spectacular OpenAPI schemas)
2. Update your settings file:
import os
INSTALLED_APPS = [
...
"rest_framework",
"cube_proxy",
]
# Required
CUBEJS_API_URL = os.environ["CUBEJS_API_URL"]
CUBEJS_API_SECRET = os.environ["CUBEJS_API_SECRET"]
CUBE_PROXY_IDENTITY_RESOLVER = "myproject.cube.resolve_identity"
# Optional
CUBE_PROXY_PERMISSION_CLASSES = (
"rest_framework.permissions.IsAuthenticated",
"myproject.permissions.IsModerator",
)
CUBE_PROXY_JWT_CLAIM_NAME = "tenant" # default
CUBE_PROXY_JWT_TTL_HOURS = 24 # default
CUBE_PROXY_JWT_ALGORITHM = "HS256" # default
CUBE_PROXY_REQUEST_TIMEOUT = 30 # default
CUBE_PROXY_IDENTITY_NOT_FOUND_DETAIL = "Identity could not be resolved."
``CUBE_PROXY_IDENTITY_RESOLVER`` is the dotted path to a callable
``resolve(user) -> str | None``. The returned value is stamped into the
JWT under ``CUBE_PROXY_JWT_CLAIM_NAME`` (default ``tenant``) and becomes
the Cube.js security-context key. Returning ``None`` yields a
``403 {"detail": "Identity could not be resolved."}`` response.
3. Add the URLs:
from django.urls import include, path
urlpatterns = [
...
path("cube/", include("cube_proxy.urls")),
]
The endpoint is then available at ``/cube/load/`` and accepts both ``GET``
(query-as-URL-params, used by the Cube.js JS SDK for small queries) and
``POST`` (query in body, used for large queries).
Metadata
Release files for ngits-drf-cube-proxy 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ngits_drf_cube_proxy-1.0.1.tar.gz | 7.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ngits_drf_cube_proxy-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / ngits_drf_cube_proxy-1.0.1.tar.gz
| Download URL | ngits_drf_cube_proxy-1.0.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1c821a73e9144b315080f04c0ef0cd891d7ba8ca11490c6bd00ea2624ad1300
|
|
BLAKE2b-256 checksum How to use checksums |
0600de776788d36d80ac889137521ccfd000904371606c7dd1fcb8a6ce2c7dca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / ngits_drf_cube_proxy-1.0.1-py3-none-any.whl
| Download URL | ngits_drf_cube_proxy-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c796d12cf34841118d4040b893e93b2da3b9ca5e12fcaad7c3aa128af642ee8
|
|
BLAKE2b-256 checksum How to use checksums |
2c8d1f9f974c14864fd4f63736b5da3651885268a3a75d10749713dfef1a94d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Security for ngits-drf-cube-proxy 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.