Auth / Auth and Guard

Failures, end to end

What happensAuthGuardThe client sees
No cookiea visitor (Option.none())rules decide for a visitorguarded rows absent; Me.signedIn false
A cookie from another site, or without the CSRF header401never askeddenied: Unauthenticated
A session that ended (signed out, expired, revoked)401, Your session ended.never askeddenied: Unauthenticated
Another tab switched account401, SUBJECT_CHANGED (with believing)never askedforget and read again
Signed in, reading a row a Read rule refusesthe userthe row is filtered outthe row is absent, as if it did not exist
Signed in, a write a Write rule refusesthe user403 before the write runsdenied: Forbidden
A server Source that skips its Read rules—GuardServer.validate throws at startupthe server does not start

Using one without the other

  • Guard without auth. Any resolvePrincipal that returns the guard set's principal works: a bearer token, a header in a test, a service binding. The guard README's examples provide one directly, as G.Principal.
  • Auth without guard. AuthServer.resolver returns whatever your principal builds; your Sources may read it directly. You lose enforcement on every seam from one declaration, and Me.