Skip to main content

SSF event streams

An MCP server or an API that checks Casdoor's tokens often caches them, and keeps accepting a token until it expires. With the Shared Signals Framework (SSF), Casdoor pushes a signed event to it as soon as access ends, so that it can drop the user's sessions at once.

Casdoor is the transmitter. Each SSF stream sends the events of one application to one receiver: a system that trusts the tokens of that application.

Events​

EventWhen Casdoor sends it
CAEP session-revokedA user revokes an application under AI apps or Consents, an administrator revokes it under AI connections, or an administrator disables the agent of the application or sets an expire time that has passed.
CAEP credential-changeA user's password changes.
RISC account-disabledA user is forbidden to sign in.
RISC account-enabledA forbidden user may sign in again.
RISC account-purgedA user is deleted.

The subject of an event names the user by iss and sub (the user's ID), and the application by its client ID when the event is about one application.

Create a stream​

Open LLM AI > SSF Streams and add a stream:

FieldDescription
ApplicationThe application whose tokens the receiver accepts. Casdoor signs the events with its certificate, and its client ID is the audience.
Endpoint URLWhere Casdoor posts the events (push delivery, RFC 8935).
Authorization headerOptional, sent as the Authorization header of each push, for example Bearer <secret>.
Events requestedThe events to send.
Statusenabled, paused or disabled.

Send verification event checks that the receiver accepts the events. The stream page shows how many events were delivered and the last error.

Casdoor doesn't post to private network addresses, except for streams of the built-in organization or with ssfAllowIntranet = true in conf/app.conf.

Receive the events​

Each event is a Security Event Token (RFC 8417): a JWT with the header typ: secevent+jwt, posted with the content type application/secevent+jwt. Verify it with the keys at https://<casdoor-host>/.well-known/jwks, check that aud is the client ID of the application, and answer 202 Accepted.

{
"iss": "https://<casdoor-host>",
"aud": "<client-id>",
"jti": "2b2d3215-9cae-43d9-b3cd-ef14044fb153",
"iat": 1796488247,
"sub_id": {
"format": "complex",
"user": {"format": "iss_sub", "iss": "https://<casdoor-host>", "sub": "<user-id>"},
"application": {"format": "opaque", "id": "<client-id>"}
},
"events": {
"https://schemas.openid.net/secevent/caep/event-type/session-revoked": {
"event_timestamp": 1796488247,
"initiating_entity": "user",
"reason_user": {"en": "the access of my-agent was revoked"}
}
}
}

Manage the stream from the receiver​

Receivers can manage their stream with the SSF API, using an access token of the application from the client credentials grant. Casdoor describes the API at https://<casdoor-host>/.well-known/ssf-configuration.

EndpointDescription
GET /api/ssf/stream?stream_id=<name>Read the stream configuration. Without stream_id, list the streams of the application.
POST /api/ssf/streamCreate a stream with delivery (method must be push, endpoint_url) and events_requested.
PATCH / PUT /api/ssf/stream?stream_id=<name>Change the stream.
DELETE /api/ssf/stream?stream_id=<name>Delete the stream.
GET / POST /api/ssf/statusRead the status, or set it to enabled, paused or disabled with a reason.
POST /api/ssf/verifyAsk for a verification event, with an optional state that the event carries back.