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
+23 -2
View File
@@ -10,7 +10,7 @@ a temporary folder. Run these on a machine or VM you don't mind changing.
cd ~/Projects/coreapp-dev
for f in install.sh update.sh uninstall.sh bin/coreapp-vm bin/coreapp libvirt/network-hook.sh; do bash -n "$f"; done
shellcheck -x install.sh update.sh uninstall.sh bin/coreapp-vm bin/coreapp libvirt/network-hook.sh
python3 -m py_compile core/coreapps && rm -rf core/__pycache__
python3 -m py_compile core/coreapps lib/signin.py && rm -rf core/__pycache__ lib/__pycache__
```
## install.sh
@@ -322,7 +322,28 @@ has the `DB_*` variables, `.coreapp` says `needs=postgres`.
9. Stock Vikunja (`vikunja/vikunja:2.8.0` with a busybox entrypoint,
`[sso] callback = "/auth/openid/core"`, `pkce = false`): `/api/v1/info`
lists the "Federated Core" provider; a browser sign-in with a Core
account works.
account works. `coreapp signin --code` gives a code for
`/auth/openid/core`; `POST /api/v1/auth/openid/core/callback` with it
and `redirect_url` returns a token, and `/api/v1/user` with it is
`coreapp.test@<domain>`.
10. `coreapp signin` (sso-demo): prints each step (login, authorize,
Authelia's page, `POST /api/firstfactor -> 200 OK`, authorize again,
the callback, the app's page) with no code, state or flow_id values,
ends "Signed in: back at the app, ... HTTP 200" and "Its page shows
coreapp.test", exit 0. On the Core, LDAP has `uid=coreapp.test,ou=people`
(`inetOrgPerson`, description `coreapps: test account for coreapp
signin`); a second run sets a new password and reuses it. `--cookies
jar /login`, then `curl -b jar https://sso-demo.<domain>/`: "Signed in as
coreapp.test". `coreapp signin /nope`: "didn't lead to the Core's
sign-in", exit 1. `coreapp signin login` and in an app without "sso":
refused. `--code`: the callback URL, `code`, `state`, `code_verifier`
(PKCE apps only), exit 0. `lib/signin.py --code` with a callback the
client doesn't have: Authelia's `invalid_request` and the hint "The
'redirect_uri' parameter does not match", exit 1. A wrong password:
"Authelia refused the test account", exit 1 (no more than two: Authelia
bans after three). `coreapp signin --remove-account`: "Removed", then
"There's no test account"; `coreapp signin` makes it again.
`coreapps test-account` with less than 16 characters on stdin: refused.
### With mysql