Auth / Auth and Guard
Failure scenarios end to end
| Scenario | Auth | Guard | Client sees |
|---|---|---|---|
| No cookie | Option.none() visitor | Evaluates visitor rules | Public rows only; signedIn: false |
| Missing CSRF or foreign cookie | 401 | Skipped | denied: Unauthenticated |
| Expired or signed-out session | 401 (Your session ended.) | Skipped | denied: Unauthenticated |
| Other tab switched accounts | 401 (SUBJECT_CHANGED) | Skipped | Call Remote.forget and re-fetch |
| Read rule fails for user | Resolves User | Filters row out | Row omitted from results |
| Write rule fails for user | Resolves User | 403; write aborted | denied: Forbidden |
| Source skips Read rules | — | GuardServer.validate throws | Server refuses to boot |
Using Guard or Auth on its own
- Guard without Auth: Supply any
resolvePrincipalfunction returning your principal type (for example, a bearer token parser or test header reader). - Auth without Guard:
AuthServer.resolverreturns yourUserdirectly so custom Sources can inspect it, though you give up shared declarative enforcement and automaticMeflags.