Add coreapp signin: test an app's sign-in on the Core, as a browser would

The Vikunja rehearsal's agent could only test sign-in against a stand-in
Authelia. coreapp signin follows the app's sign-in through the Core's real
Authelia as a test person (coreapp.test, made by coreapps test-account
with a new random password each run, kept nowhere), prints each step with
Authelia's errors, and says whether it got back to the app signed in.
--code covers apps that start sign-in in the browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 17:57:48 -07:00
co-authored by Claude Opus 5.5
parent 5d06f1bd9b
commit da767e2139
8 changed files with 422 additions and 15 deletions
+37 -8
View File
@@ -170,7 +170,8 @@ pick the key so the path is known), whether it sends `code_challenge`,
and how it sends the secret. Authelia checks the redirect URI when the
sign-in starts (an error page instead of its login page if it's wrong), but
PKCE and the secret only after the person has signed in, so a curl of the
authorize URL can't show those are right: a real sign-in can. Changing
authorize URL can't show those are right: `coreapp signin` can (see
"Deploy and test"). Changing
`[sso]` and deploying registers the client again; Authelia restarts for it
(a few seconds of 404s from it, which an app checking discovery at startup
may log; it should retry).
@@ -323,8 +324,33 @@ Then test it like a person would: open `https://<name>.<domain>/` (curl it,
or ask the user to use a browser), sign in if it has `sso`, and check that
what it stores survives `coreapp deploy --recreate` (data in `/data` and
the database).
Signing in needs a real Core account and a browser: ask the user to do that
step and tell you what happened.
Sign in with `coreapp signin`: it signs in to the app as a browser would,
on the real Authelia with the app's real client, as the Core's test account
(`coreapp.test@<domain>`, display name `coreapp.test`, in no groups; made on
the Core in the VM when first needed, with a new password each time). It
prints each step, with Authelia's error if the client doesn't fit, and says
whether it got back to the app signed in:
```bash
coreapp signin # starts at /login
coreapp signin /auth/login # the app's own page that starts sign-in
coreapp signin --cookies jar /login && curl -b jar https://<name>.<domain>/api/me
```
For apps whose sign-in starts in the browser's JavaScript (single-page
apps: the page builds the authorize URL itself), `coreapp signin --code`
starts at Authelia with the app's client and stops at the app's callback,
printing it with the code; give that to the app as its page would (e.g.
Vikunja's: `POST /api/v1/auth/openid/<key>/callback` with `code` and
`redirect_url`). Its `state` is not the app's, so a callback that checks
state (a server-side callback page) refuses it: use the path form for those.
Authelia bans an account for a few minutes after repeated failed sign-ins,
so don't loop on it.
Still ask the user to sign in once in a browser with their own account
before a release: it checks what a script can't (the app's pages, and a
person in the Core's groups).
### 4. When something fails
@@ -332,6 +358,7 @@ step and tell you what happened.
|---|---|
| `coreapp status` | Its container, address, port, needs, URL |
| `coreapp logs` / `coreapp logs -f` | The app's own log |
| `coreapp signin [path]` | Signs in with the Core's test account and shows each step |
| `coreapp shell '<command>'` | Run one command in its container, e.g. `coreapp shell 'id; env; ls -l /data'` (without a command it opens an interactive shell, which needs a terminal) |
| `coreapp list` | All apps on the Core installed this way |
| `coreapp remove` | Uninstall it (asks first; deletes its data and database) |
@@ -351,9 +378,11 @@ Common causes:
- `coreapp check` fails but deploy worked: a new certificate can take a
minute; it retries for two. It also tries the VM directly, which tells the
app apart from the way in.
- Sign-in fails with "redirect_uri" errors: the app isn't using
`$APP_URL/auth/callback`. "invalid_client": it isn't sending the secret
with `client_secret_basic`, or isn't using PKCE.
- Sign-in fails (`coreapp signin` shows Authelia's error and hint): "The
'redirect_uri' parameter does not match" means the app's callback isn't
the client's (`[sso] callback`); "invalid_client" means it sends the
secret another way (`[sso] token_auth`); a PKCE error means `[sso] pkce`
doesn't match what the app does.
- Permission denied under `/data`: the app switches to another user after
starting (the Core gives `/data` to the image's `USER`), or it writes
somewhere else in the container (`coreapp shell 'id; ls -ld /data'`).
@@ -408,8 +437,8 @@ When you're done, tell the user:
- what you changed in the repository (`coreapp.toml`, Dockerfile, config),
- what you tested and how (deploy, check, which pages, a redeploy keeping
data), and what they still need to test themselves (signing in in a
browser),
data, `coreapp signin`), and what they still need to test themselves
(signing in in a browser with their own account),
- anything the app needs that the Core doesn't offer yet, and how you
handled it,
- anything in coreapp-dev that got in the way or was unclear. coreapp-dev is