Skip to content
Workforce IdentityMarkdown

Cut a user off now

When an account is compromised or someone leaves in a hurry, stop their sign-in, sessions, tokens and agents in minutes, and know what still lags and for how long.

API

A laptop is stolen, a password turns up in a paste, or someone leaves on bad terms. You need everything they hold to stop now: new sign-ins, the sessions they have open, the tokens apps hold for them, and the agents that act in their name. No single switch does all of it, so this runbook takes four steps, in an order that closes each door before the next. Done in order, it takes a few minutes.

Before you start:

  • Who can do it: a realm administrator, in a group that holds RealmOwner (Delegated administration).
  • Where: today this is done through the API, with your session in $CVYUH_SESSION (Call the API). Sign in once and keep the session for the whole runbook.
  • What you need: the user’s name, here ben, and their id (GET https://foobar.cvyuh.com/api/v0/am/objects/v1/user/ben answers it as id).
  1. Deactivate the user. From this moment they can’t sign in, no app can get a new token for them, every refresh token they hold stops working, and introspection reports their tokens inactive:

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/user/ben \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "status": "inactive" }'

    Deactivating also stops every agent whose chain leads up to ben: each agent’s token request walks up its chain to the user at the top, and an inactive user stops it.

  2. End every session they hold. Deactivating doesn’t end sessions already open, so end them all. Each ending is a sign-out: apps that listen for back-channel logout end their own sessions, and tokens issued under the session are revoked:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/sessions/v1/end \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "qbe": { "filter": { "field": "user", "op": "=", "value": "<ben id>" } } }'

    The realm answers how many it ended: { "ended": 3 }.

  3. Stop the agents they own. An agent whose business owner is ben but whose chain leads up to someone else keeps running after step 1. List the agents he owns:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/objects/v1/user/ben/relationships/ownedAgents \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    and quarantine each one, which also stops every agent under it:

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/invoice-agent \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "status": "quarantined" }'

    Quarantine can be undone; kill an agent only when you’re sure (Stop an agent).

  4. Rotate what they knew. If they could read an app’s client secret, rotate it, so a copy they kept stops working once the overlap you choose ends (Rotating a secret with an overlap).

New sign-ins, new tokens and refreshes stop at once, everywhere, because only the realm issues them. A token already issued stops as fast as the API that checks it learns of it:

Where the token is checkedIt stops working
The realm itself: userinfo, refresh, token exchangeAt once
An API that introspects each token, or asks the realm for a decisionAt once
An API behind the gatewayWithin seconds, at the gateway’s next revocation poll (10 seconds by default)
An API that checks signatures and reads status listsWithin a minute
An API that checks signatures onlyWhen the token expires: five minutes by default
An app’s own session, if the app ignores back-channel logoutWhen the app next needs a token, or its own session ends

See How fast revocation takes effect to make the slow rows faster.

  • The user reads "status": "inactive", and GET https://foobar.cvyuh.com/api/v0/am/sessions/v1 with a filter on their id lists no sessions.
  • Their agents read quarantined.
  • On the audit trail (Read a user’s or agent’s trail, or Audit → Authentication and Audit → Config in the dashboard):
    • the deactivation, as PATCHED with status before and after;
    • one LOGOUT for each session ended;
    • AGENT_QUARANTINED for each agent;
    • from then on, any attempt: LOGIN_FAILED with the reason AUTH_USER_INACTIVE, and TOKEN_ISSUED refused for any app or agent that asks for a token for them.
SymptomCauseFix
The user still reaches an appThe app checks tokens by signature only, or keeps its own session and ignores logoutWait out the access token (5 minutes by default); put the API behind the gateway or have it introspect; have the app listen for back-channel logout
An agent still gets tokensIts chain leads to another user, and it wasn’t quarantinedQuarantine it (step 3), or the agent above it
Ending sessions answers { "ended": 0 }They had no live session, or the id is wrongCheck the id from the user’s record
An app still uses a secret they knewIt wasn’t rotatedRotate it (step 4)

Set { "status": "active" } on the user, and set each agent back to active (released agents are recorded as AGENT_RELEASED). Sessions don’t come back: the user signs in again, and apps ask for new tokens.