# Receive signals

> End a user's access here the moment your workforce identity provider disables them or finds their credentials compromised.

Your workforce identity provider is often the first to know that someone has left or that their password has leaked.
Register it with the realm as a trusted sender, and when it pushes that event, the realm ends the user's sessions here,
revokes every token and grant they hold, offline access included, and quarantines the agents they own. Nothing waits
for a token to expire.

## Before you begin

- **Who can do it:** a realm administrator (a group holding `RealmOwner`); `RealmViewer` can read the provider's
  registration but not change it.
- **Where:** today this is set through the API ([Call the API](/develop/api/) shows how to get `$CVYUH_SESSION`).
- **First:** your provider can send Shared Signals events by push, and you know its issuer and where it publishes its
  keys. Each user it will report on is linked to their identity there.

## How it works

You register the provider as an `ssfTransmitter` object, with its issuer and the keys its events are signed with, and
list the events you want acted on. The provider pushes its events to
`https://foobar.cvyuh.com/oauth2/ssf/receive/<transmitter>`, where `<transmitter>` is that object's id. An event is answered `202` once
accepted, or `400` with the reason it was refused.

The realm finds the user only through a link you made between the provider's identifier and the user here, held in
the user's `externalIds` for that provider's issuer: never by email.

### What the realm does

| Event received | What the realm does |
|---|---|
| RISC `account-disabled` | Ends their sessions and revokes everything they hold, offline access included. With `onAccountDisabled: deactivate`, also sets the user inactive. Their agents are quarantined unless `onOwnerDisabled` is `none` |
| RISC `credential-compromise` | Ends their sessions and revokes everything they hold |
| CAEP `session-revoked` | Ends every session they hold here |
| RISC `account-enabled` | Nothing. Only a realm administrator re-enables a user |
| CAEP `credential-change` | Nothing. It's acknowledged and ignored |

Revoking everything a user holds reaches the gateway too: every token about them issued before that moment is
refused there within seconds. See [How fast revocation takes effect](../../../gateway/revocation/how-fast/).

## Set it up

Each call sends your session as `$CVYUH_SESSION` ([Call the API](/develop/api/)).

1. Register the provider:

   ```sh
   curl -X POST "https://foobar.cvyuh.com/api/v0/am/objects/v1/ssfTransmitter?id=workforce" \
     -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
     -H "Content-Type: application/json" \
     -d '{ "issuer": "https://login.partner.example",
           "jwksUri": "https://login.partner.example/keys",
           "status": "active",
           "eventsAccepted": [
             "https://schemas.openid.net/secevent/risc/event-type/account-disabled",
             "https://schemas.openid.net/secevent/risc/event-type/credential-compromise",
             "https://schemas.openid.net/secevent/caep/event-type/session-revoked" ],
           "onAccountDisabled": "revoke",
           "onOwnerDisabled": "quarantine" }'
   ```

2. Link each user to their identity at the provider, as in
   [Accept a partner's identity](../../guides/partners/accept-a-partner-identity/).
3. Give the provider the push address: `https://foobar.cvyuh.com/oauth2/ssf/receive/workforce`.

## What the user sees

Nothing, until their next request: their sessions here have ended, so the next page asks them to sign in, and their
tokens are refused at the realm and the gateway. With `onAccountDisabled: deactivate`, signing in again is refused as an
inactive account until a realm administrator sets them active.

## Limits and defaults

| Setting or limit | Default | Range |
|---|---|---|
| Events acted on (`eventsAccepted`) | None | Any of the five events above |
| `onAccountDisabled` | `revoke` | `revoke` or `deactivate` |
| `onOwnerDisabled` | `quarantine` | `quarantine` or `none` |
| An event's age when it arrives | Up to 24 hours | Fixed |
| Acting on one event | Once, by its `jti` | Fixed |
| Subject formats | `iss_sub`, `opaque` | Fixed |

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| The provider is told `400` | The event isn't signed by the keys you registered, isn't addressed to this realm, is too old, or the provider is `inactive` | Check `issuer`, `audience` and `jwks` or `jwksUri` against what the provider sends; set `status` to `active` |
| The event is accepted (`202`) but nothing happens | The event type isn't in `eventsAccepted`, the user isn't linked, or the subject is named by email | List the event; link the user ([Accept a partner's identity](../../guides/partners/accept-a-partner-identity/)); have the provider send `iss_sub` or `opaque` |
| The user's agents keep running | `onOwnerDisabled` is `none`, or the agents' business owner isn't this user | Set `quarantine`; stop the agents yourself ([Stop an agent](../../guides/agents/stop-an-agent/)) |

## Audit record

What an event does is recorded as the change it made, with the provider as the actor: the user's sessions ending
(`LOGOUT_ALL`), a deactivation as a change to the user (**Audit → Config**), and each agent quarantined as
`AGENT_QUARANTINED`, naming the provider and the event's `jti`. The event's arrival itself, and an event that changed
nothing, aren't recorded yet.

## Good to know

- **Signed, addressed, recent, once.** An incoming event must be signed by the provider's keys, addressed to this
  realm and recent, and is acted on once. An inactive provider's events are refused.
- **Only what you list is acted on.** `eventsAccepted` is empty by default, so nothing is acted on until you list
  events. Others are acknowledged and ignored.
- **Nothing learned from strangers.** An event about someone the realm has no link for is answered `202` like any
  other and dropped, so a provider learns nothing about who has an account here.
- **Subjects by `iss_sub` or `opaque` only.** An event naming its subject any other way, an email included, names no
  one.

## Reference

### Fields

| Field on `ssfTransmitter` | What it sets |
|---|---|
| `issuer`, `audience` | Who the provider is, and the audience its events name |
| `jwks` or `jwksUri` | The keys its events are signed with |
| `status` | `active` (default) or `inactive`. An inactive provider's events are refused |
| `eventsAccepted` | The event types acted on. Empty by default |
| `onAccountDisabled` | `revoke` (default): revoke everything the user holds. `deactivate`: also set the user inactive |
| `onOwnerDisabled` | `quarantine` (default): the user's agents are quarantined. `none`: they're left as they are |

## Coming next

- **Device compliance** from your device manager, feeding decisions: see [What's next for signals](../whats-next/#device-compliance).

## Related

- [Share security signals](../../guides/share-security-signals/): the task, both directions.
- [Send signals](../shared-signals/): tell other systems what happens here.
- [Stop an agent](../../guides/agents/stop-an-agent/): quarantine and kill, by hand.
