Let apps describe their sign-in client: [sso] callback, pkce, token_auth
A rehearsal with Vikunja showed apps with their own redirect path or no PKCE needed a bridge in the container. coreapp.toml's [sso] now sets the Authelia client's callback, PKCE and token method; changes re-register the client, and a failed update restores it. The skill covers [sso], images without a shell and upstream ENV defaults; coreapp shell and status explain rough edges the rehearsal hit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+46
-5
@@ -145,13 +145,35 @@ and adds:
|
||||
| `OIDC_CLIENT_ID` | `coreapp-<name>` |
|
||||
| `OIDC_CLIENT_SECRET` | random |
|
||||
|
||||
The client is fixed, so the app has to fit it:
|
||||
The client, by default:
|
||||
|
||||
- Redirect URI: exactly `https://<name>.<domain>/auth/callback`
|
||||
(`$APP_URL/auth/callback`). If the app's library uses another callback
|
||||
path, configure the library, or route `/auth/callback` to it.
|
||||
(`$APP_URL/auth/callback`).
|
||||
- Authorization code flow, PKCE with S256 required, client authentication
|
||||
`client_secret_basic` (secret in the Authorization header).
|
||||
|
||||
If the app's sign-in can't be configured to match (many have a fixed
|
||||
callback path, and many don't send PKCE), change the client in
|
||||
`coreapp.toml` instead of working around it in the app:
|
||||
|
||||
```toml
|
||||
[sso]
|
||||
callback = "/auth/openid/core" # the app's callback path (default "/auth/callback")
|
||||
pkce = false # the app doesn't send PKCE (default true)
|
||||
token_auth = "client_secret_post" # it sends the secret in the form (default client_secret_basic)
|
||||
```
|
||||
|
||||
Set only what the app needs, and say in a comment why. Find out from the
|
||||
app's documentation or source: the callback path it puts in `redirect_uri`
|
||||
(sometimes built in the browser, e.g. `/auth/openid/<provider key>`; then
|
||||
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
|
||||
`[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).
|
||||
- Scopes: `openid profile email groups`. Userinfo gives `sub`,
|
||||
`preferred_username`, `name`, `email`, `groups` (the person's Core
|
||||
groups: use them for roles, e.g. admins).
|
||||
@@ -192,7 +214,10 @@ The Core's AI features (offering
|
||||
tools to its AI agent, or using its model), extra services such as Redis or
|
||||
a second container, extra hostnames, and public ports other than HTTPS.
|
||||
If the app can't work without one of these, say so plainly in your report
|
||||
rather than working around it; the gap is useful to know. If it's optional
|
||||
rather than working around it; the gap is useful to know. The same goes for
|
||||
a need that doesn't fit the app (e.g. a sign-in `[sso]` can't describe):
|
||||
report it rather than writing a proxy, bridge or second service into the
|
||||
app's container. If it's optional
|
||||
(e.g. email notifications), leave it off and note it.
|
||||
|
||||
## Workflow
|
||||
@@ -236,7 +261,23 @@ and make the Dockerfile fit the Core:
|
||||
resets, notifications): map `SMTP_*` onto its mail settings.
|
||||
- **Read settings from the environment**, mapping the Core's names to the
|
||||
app's in an entrypoint script or config file if they differ
|
||||
(`SECRET_KEY="$APP_SECRET"`, `DATABASE_URL=...`).
|
||||
(`SECRET_KEY="$APP_SECRET"`, `DATABASE_URL=...`). Set the app's own
|
||||
variables outright rather than "only if unset": upstream images often set
|
||||
defaults in `ENV` (a SQLite path, a port) that would win otherwise.
|
||||
- **Images without a shell** (built `FROM scratch` or distroless) can't run
|
||||
an entrypoint script, and `coreapp shell` can't open one. Copy a static
|
||||
busybox in and run the script with it:
|
||||
|
||||
```dockerfile
|
||||
FROM busybox:1.37-musl AS busybox
|
||||
FROM upstream/image:1.2.3
|
||||
COPY --from=busybox /bin/busybox /bin/busybox
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/bin/busybox", "sh", "/entrypoint.sh"]
|
||||
```
|
||||
|
||||
(end it with `exec` and the upstream entrypoint; call tools as
|
||||
`/bin/busybox mkdir ...`). Prefer this to a program of your own.
|
||||
- **Run as a non-root user** if the image allows. `/data` is given to
|
||||
whatever user the image runs as, so this is enough:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user