Bearer Token¶
Extension API signs short-lived JWT bearer tokens when creating web-ui connections. These tokens bootstrap the user’s session — they are not session tokens themselves.
Bearer token flow¶
A user creates a
WorkspaceConnectionwith typeweb-ui.Extension API signs a JWT with the user’s identity, scoped to the workspace’s path and domain.
The token is embedded in a URL (rendered from the access strategy’s
bearerAuthURLTemplate).The user opens this URL in their browser.
Auth middleware validates the token via a
BearerTokenReviewcall back to Extension API, then issues a long-lived session cookie.
Token properties¶
Property |
Value |
Notes |
|---|---|---|
Type |
|
Distinguishes from session tokens |
TTL |
5 minutes (default) |
Short-lived — meant for immediate use |
Issuer |
|
Identifies the Extension API |
Audience |
|
Validated by BearerTokenReview |
Skip refresh |
|
Bootstrap tokens are never refreshed |
Claims¶
The bearer token includes:
Subject — the Kubernetes username
Groups — the user’s group memberships
UID — the Kubernetes user UID
Extra — additional user info from the K8s auth layer
Path — workspace path prefix (e.g.
/workspaces/team-alice/my-notebook)Domain — the host the token is valid for
Signing¶
Extension API uses a CompositeSignerFactory that supports multiple signing backends:
k8s-native — HMAC signing with keys stored in a Kubernetes Secret. This is the default when
extensionApi.jwtSecret.enable=true.Plugin-delegated — signing delegated to a plugin via
JwtPluginApis. Used when an access strategy references a plugin-backed signer.
The signer selection depends on the access strategy configuration.
BearerTokenReview¶
When Auth middleware receives a bearer token URL, it calls Extension API’s bearertokenreviews endpoint:
Extension API extracts the
kidfrom the token header and validates the signature against the corresponding key.It checks that the token has not expired.
It returns the authenticated user identity (username, groups, UID, extra, path).
Auth middleware uses this identity to issue a session cookie.