
# Opening a calendar or a screen without opening the administration

Two links open through a URL alone, with no session: a staff member's calendar feed and the control room's wall screen. Both carry their token in the path, and their scope is deliberately one route each: it must not widen.

## The calendar subscription (ICS): a second token, scoped to a single document

`GET /api/abonnements/{token}/planning.ics` is the **only** route of the application that a URL alone opens: a subscribed calendar client carries no cookie and cannot answer an authentication challenge, so the subscription would otherwise be a `401` at the first resync.

![Reading an ICS subscription and revoking it](repo:docs/diagrammes/abonnement-ics.svg)

<sub>Source: [`diagrammes/abonnement-ics.puml`](repo:docs/diagrammes/abonnement-ics.puml).</sub>

### Why one more token rather than the space token

The subscription token is a separate key (`animateur.abonnement_token`), generated the same way as the other (`gen_random_uuid()`, 122 bits of randomness, global uniqueness) but with an independent life cycle ([decision 0019](repo:docs/decisions/0019-jeton-et-chemin-dedies-pour-l-abonnement-ics.md)).

### What it allows, exactly

Its holder can read, indefinitely, **a single document**: its owner's published schedule, that is their shifts, their stands and the teammates their individual PDF already prints. It is named data: this token says *who works where and when*, for one person. It opens neither the staff space, nor swap requests, nor availabilities, nor the directory, does not download the PDF and writes nowhere. The guard that resolves it is bound to a single route (`@AbonnementTokenRequired`), and the space token does not work on this route, nor the reverse.

### Revocation

**The staff member revokes it themselves**, from their space ("this address leaked, replace it"). The address is shown only there, so its holder is the only one who can know it leaked, and reaching that button already costs the space token **and** the e-mail code, a stronger proof than the subscription's. The rotation kills the old address immediately without affecting the space token (the link already printed on a PDF survives). A deleted record or edition takes its token with it: the address ceases to exist (`404`). There is no "subscribed / not subscribed" state: the token always exists.

An admin gesture to revoke someone else's subscription is missing, deliberately: to cut off a person who has left, delete their record, which cuts everything.

### The token in the path, and the logs

Like the space token, it lands as is in the reverse proxy's access logs, **far more often**: a calendar client resyncs by itself, several times a day, from each device. Purge those logs or write them without these paths ([what remains the reverse proxy's responsibility](securite.md#ce-qui-reste-à-la-charge-du-reverse-proxy)). `Referrer-Policy: no-referrer` covers the rest.

### No rate limiter here, and why

The application's limiters bound authentication attempts, a mail send or the use of a shared key that opens everything. This route reads, with no side effect, on a token that opens one document. A per-staff cap would be **counter-productive**: a subscription resyncs by itself, from a phone, a computer and a tablet at once, at a pace the application does not choose. Enumeration is not feasible over 122 bits of randomness; an unknown or revoked token gets the same fixed-phrase `404` ("Subscription unknown or revoked"), which reveals nothing; and **the reverse proxy's per-IP limiting remains the first line**, as for exports and the rest of the API.

Still open: nothing bounds the cost of a badly configured client calling every minute. Each call recomposes the published plan on the day's reference data (the publication is read once then kept in memory), like the space download: not a new class of load, but the first triggered by a machine rather than a human.

### The rule on the access-proxy side

The `/api/abonnements/` prefix **exists only for this route**: an access proxy that authenticates its visitors (Pangolin and the like) needs a URL pattern that designates only the feed to except.

| To configure | Value |
| --- | --- |
| Authentication exception | `/api/abonnements/*`, and **this prefix alone** |
| What not to do | widen the exception to `/api/espace-animateur/*`: it would open in the same gesture every route of the space, including its only public write |

On the application side, the same exception is declared in `application.properties` (`quarkus.http.auth.permission.abonnement-ics`), and `AuthentificationAdminTest` checks that it applies and that it **does not spill** beyond the prefix.

## The wall display: a third token, for an unattended screen

`GET /api/mural/{jeton}` is the route the control-room TV reads, and the **only** one under the `/api/mural/` prefix, exempted from admin authentication like `/api/abonnements/` ([decision 0053](repo:docs/decisions/0053-affichage-mural-par-jeton-dedie.md)).

### What it allows, exactly

One read, for **one** edition: the day's open stands, who holds them (first name and initial of the surname, or full name if the link was created so), free seats, breaks with no relief and the day's consigne. No reference data, no exports, no staff space, no write; no phone, e-mail, age or reason for absence (the record's phone leaves only to an administration session, the wall view has no field to receive it, and its "unpublished changes" is a count, never a list of names). "Show on the TV", from Today, creates the same link as Settings: the whole edition, initials. The token works on no other route, and the space and subscription tokens do not work on this one.

### Creation, storage, revocation

The administrator creates links from **Settings → Wall display**, with a label, the full-names option and, if needed, the locations shown (one TV per zone). The token (256 bits of randomness) is shown **only once**: the database keeps only its SHA-256 fingerprint, like the space sessions, so a copy of the database reopens no screen, and a lost address is replaced by a new link. The list shows the date of last access, to the minute. Revoking cuts the screen at its next read; deleting the edition takes its links. An unknown token and a revoked one get the same `404`. Creation and revocation are logged, reads are not (one per minute per screen is not a trace).

"Print", on the Schedule page, opens the same layout (`/impression/:date`) with no token: it reads `GET /api/affichage-mural/apercu` **under the admin session**. Nothing is added under `/api/mural/`.

Links travel neither in the SQL export nor in an edition duplication: they are accesses of this instance. Expected downside: **importing a SQL dump deletes them all** (the import empties the editions, the links go in cascade, even for an edition recreated identically). Recreate them from Settings after each import; each TV reopens on its new address.

### Rate, cache and logs

`AffichageMuralRateLimiter` carries two guards, neither counting an address's valid reads:

- **refused reads, per address**: only a `404` (unknown or revoked token) counts. Beyond the cap, the address gets `429` with `Retry-After` for any token it has not already read successfully, until one window after its last refusal: trying tokens costs time and no longer touches the database;
- **reads, per valid link**: a wide cap that bounds what a leaked address can draw, a link possibly being open on several screens.

A token already served (kept in memory by its fingerprint) passes even when its address is locked: noise from the same address never cuts a screen. This matters **behind an undeclared proxy** (`CONNEXION_PROXYS_FIABLES` empty, the default), where every request carries the proxy's address: a cap on all requests would let thirty random requests a minute switch off every TV of the event. Declaring the proxies remains necessary: without it, such noise locks the shared address, and a **new** screen, or the first display after a restart that empties the memory, waits for the window to end.

| Variable | Default | Use |
| --- | --- | --- |
| `AFFICHAGE_MURAL_MAX_REFUS` | `30` | Refused reads tolerated per address before the lockout; `0` switches it off |
| `AFFICHAGE_MURAL_MAX_LECTURES_PAR_LIEN` | `120` | Reads served per link and per window; `0` switches the cap off |
| `AFFICHAGE_MURAL_FENETRE` | `PT1M` | Lockout duration (from the last refusal) and per-link window |

The response carries `Cache-Control: no-store` (it names people and changes every minute) and `X-Robots-Tag: noindex`. The token returns **every minute** in the reverse proxy's access logs: same precautions as for the subscription ([what remains the reverse proxy's responsibility](securite.md#ce-qui-reste-à-la-charge-du-reverse-proxy)). It goes to no third party: the `/mural/*` page does not load the Cloudflare beacon, and error reports replace the token of `/mural/…` and `/api/mural/…` with `<jeton>`, like the space's ([`observabilite.md`](observabilite.md)).

### The rule on the access-proxy side

| To configure | Value |
| --- | --- |
| Authentication exception | `/api/mural/*`, and **this prefix alone**, plus the SPA route `/mural/*`, which carries no data |
| What not to do | widen the exception to `/api/affichage-mural/*`: that is link management, reserved to the admin |

On the application side: `quarkus.http.auth.permission.affichage-mural`.

## The home-screen shortcut: a manifest under the space's token

"Add to home screen" gives a shortcut with the instance's name and icon that opens the person's space in a window with no address bar. It needs no service worker (the notifications' one is separate, and has no cache), no cache and does not work offline ([decision 0138](repo:docs/decisions/0138-le-manifeste-d-installation-vit-sous-le-jeton-de-l-espace.md)).

The browser requires the manifest to say where the shortcut starts, and the only address that opens somebody's space is the one carrying their token. The manifest is therefore **specific to each space**, served under the space's address: `GET /api/espace-animateur/{jeton}/manifeste.webmanifest`. It adds no public route (the `/api/espace-animateur/*` prefix is already the space's, and the token is already in the path of every call), and answers exactly as the other space routes do to an unknown token or one of an inactive edition: the same `404`. It is read without a session, a browser sending no cookie for a manifest.

| What the manifest says | Source |
| --- | --- |
| `name`, `short_name` | `BRANDING_PRODUCT_NAME` |
| `theme_color` | the `accent` key of `BRANDING_COLORS`, else a neutral blue |
| `start_url`, `scope` | the person's space (`/animateur/{jeton}`) |
| `display` | `standalone` |
| `icons` | `/api/branding/icone/192` and `/api/branding/icone/512` |

It holds no data about the person, its response is `Cache-Control: private` and `Referrer-Policy: no-referrer` like the rest of the application. The **icons** are the instance's and are served without a token: with `/api/branding`, they are the only two public addresses of that prefix, named one by one in `quarkus.http.auth.permission.auth-public`. They come from the `pwa-icon` key of `BRANDING_IMAGES` (a PNG file, scaled to 192 and 512 pixels), failing that a neutral icon shipped with the application; an SVG or remote logo is never used as is. The `<link rel="manifest">` tag is laid on the space screens only.

The shortcut remembers **the address carrying the token**, like the link in the mail: a renewed token makes it useless, and the person then reopens the link they received.

### The rule on the access-proxy side

| To configure | Value |
| --- | --- |
| Authentication exception | `/api/espace-animateur/*` (already excepted for the space) and `/api/branding/icone/*`, **without** widening the `/api/branding` prefix |
