mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
fix: clarify GUEST_TOKEN_JWT_AUDIENCE usage in the SDK (#33673)
This commit is contained in:
@@ -116,8 +116,11 @@ Example `POST /security/guest_token` payload:
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, a guest token can be created directly in your app with a json like the following, and then signed
|
||||
with the secret set in configuration variable `GUEST_TOKEN_JWT_SECRET` (see configuration file config.py)
|
||||
Alternatively, a guest token can be created directly in your app without interacting with the Superset API.
|
||||
To do this, you should update the `GUEST_TOKEN_JWT_SECRET`
|
||||
in the Superset [config.py](https://github.com/apache/superset/blob/master/superset/config.py). Also set the
|
||||
`GUEST_TOKEN_JWT_AUDIENCE` variable that matches what is set for the `aud` in the JSON payload:
|
||||
|
||||
```
|
||||
{
|
||||
"user": {
|
||||
@@ -139,6 +142,13 @@ with the secret set in configuration variable `GUEST_TOKEN_JWT_SECRET` (see conf
|
||||
}
|
||||
```
|
||||
|
||||
In this example, the configuration file includes the following setting:
|
||||
|
||||
```python
|
||||
GUEST_TOKEN_JWT_AUDIENCE="superset"
|
||||
```
|
||||
|
||||
|
||||
### Sandbox iframe
|
||||
|
||||
The Embedded SDK creates an iframe with [sandbox](https://developer.mozilla.org/es/docs/Web/HTML/Element/iframe#sandbox) mode by default
|
||||
|
||||
@@ -1806,7 +1806,10 @@ GUEST_TOKEN_JWT_SECRET = "test-guest-secret-change-me" # noqa: S105
|
||||
GUEST_TOKEN_JWT_ALGO = "HS256" # noqa: S105
|
||||
GUEST_TOKEN_HEADER_NAME = "X-GuestToken" # noqa: S105
|
||||
GUEST_TOKEN_JWT_EXP_SECONDS = 300 # 5 minutes
|
||||
# Guest token audience for the embedded superset, either string or callable
|
||||
# Audience for the Superset guest token used in embedded mode.
|
||||
# Can be a string or a callable. Defaults to WEBDRIVER_BASEURL.
|
||||
# When generating the guest token, ensure the
|
||||
# payload's `aud` matches GUEST_TOKEN_JWT_AUDIENCE.
|
||||
GUEST_TOKEN_JWT_AUDIENCE: Callable[[], str] | str | None = None
|
||||
|
||||
# A callable that can be supplied to do extra validation of guest token configuration
|
||||
|
||||
Reference in New Issue
Block a user