Delegated Chat
A delegated share shows each user of your application only their own chat history and their own documents. Your backend vouches for the user; the browser never sees the gateway key or the user's assertion.
Read How the User Is Passed first — it defines exactly how the user is passed (sub of a signed JWT in X-End-User-Assertion).
Flow
You implement steps 2, 3 and 6 (highlighted in orange). Everything else is done by the component and Ragty.
Step 1: Provide the end-user assertion
Configure your identity provider so that your backend can obtain, for the currently signed-in user, a JWT with:
iss= the issuer registered in Ragty,aud= the registered audience,sub= the immutable user ID (same value as used for document ingestion),exp≤ 5 minutes, signedRS256with akidfrom the registered JWKS.
With Keycloak or another OIDC provider use token exchange to obtain a token with the Ragty audience. If your IdP cannot do that, mint the assertion yourself:
Mint the assertion yourself
Generate an RSA key pair (2048 bit or more) for this purpose only, keep the private key in your secret manager, and publish the public key as a JWKS ({"keys":[{…,"kid":"2026-11-portal","use":"sig","alg":"RS256"}]}) at an HTTPS URL. Give that URL to the Ragty administrator.
Step 2: Implement the ticket endpoint (your backend)
Add one authenticated endpoint, e.g. POST /api/m8ty/ticket, that:
requires the user's normal session (and your CSRF protection),
validates the
noncefrom the request body,mints the assertion for the session user,
calls Ragty with the gateway key and returns the ticket JSON unchanged.
Step 3: Connect the front end
The component calls your getTicket function with a nonce whenever it needs a session — on start, about every 10 minutes when the session expires, and after an administrator ended all sessions. Return the ticket JSON of your endpoint.
The iframe asks your page for tickets via postMessage; connectIframe answers only that iframe and only towards the Ragty origin. The iframe repeats its request until it is answered (up to 15 seconds); rendering it with data-src and loading it once the listener is connected answers the first request immediately. Framework examples: iframe. Keep referrerpolicy="strict-origin" so the iframe can determine your page origin.
For server-rendered Java pages. Fill the context as shown in the public example and additionally put your CSRF token (csrfToken) and the logged-in user (currentUser) into it.
$currentUseris used only for the#if. Never write a user ID into the page — the user is passed exclusively by your ticket endpoint (Step 2) inside the signed assertion.The JavaScript contains no
$or#sequences, so Velocity leaves it untouched. If you extend it, avoid template literals (${…}) or wrap the block in#[[ … ]]#(unparsed content).
Step 4: Verify
Log in as user A, ask a question, reload — the history is shown.
Log in as user A on another browser — the same history is shown.
Log in as user B — an empty chat; A's chats are not visible.
Call your ticket endpoint without a session — it must return
401/403and never reach Ragty.Open the page from a non-allowed origin — the chat must not start.