hyperhive/swarm-nats-auth/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas f287ff1ee8 feat(#3297): read the caller's identity out of introspection
The auth-callout responder learned whether a token was valid, never whose
it was, so every admitted client got the same unscoped grant. Scoping a
grant to one hive's subjects needs an identity to scope it to.

`is_active` becomes `identify_caller` and returns the identity rather
than a boolean: `Ok(Some(client_id))` admits as that client, `Ok(None)`
denies. `active: true` with no `client_id` is a denial, and returning an
identity is what makes that unrepresentable instead of remembered --
there is no admitted-but-unscoped value to construct, so there is no
branch a later edit can forget to handle.

The module deliberately ignores `sub`/`scope`/`exp` on the grounds that
modelling a field implies checking it. That still holds: `active` remains
the whole admission decision, made in one place. `client_id` answers a
different question -- as whom -- and is used downstream of an admission
that has already happened, not as a second gate. The module docs say so,
next to the paragraph that would otherwise argue for deleting the field.

An inactive token has no identity even when the body names one, and an
empty `client_id` counts as absent: it would become a blank component in
a subject the grant is scoped to, which is not a narrower permission but
a different one. The two credential parameters are renamed `own_*` --
this responder's introspection credential is not the caller's identity,
and the function now takes one and returns the other.

The grant itself is still unscoped; narrowing it is the next slice.
2026-08-16 23:48:32 +02:00
..
introspect.rs feat(#3297): read the caller's identity out of introspection 2026-08-16 23:48:32 +02:00
main.rs feat(#3297): read the caller's identity out of introspection 2026-08-16 23:48:32 +02:00
request.rs feat(swarm): the auth-callout responder (#3112 slice 2) 2026-08-15 09:34:33 +02:00
respond.rs fix(swarm): the doc link pointed at a cfg(test) item 2026-08-15 09:34:33 +02:00