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:
2026-12-03 17:45:54 -07:00
co-authored by Claude Opus 5.5
parent e2d9381c35
commit 5d06f1bd9b
10 changed files with 174 additions and 12 deletions
+3 -4
View File
@@ -15,10 +15,9 @@ cat >> "$IDP" <<OIDC
consent_mode: 'implicit'
public: false
authorization_policy: 'one_factor'
require_pkce: true
pkce_challenge_method: 'S256'
{{SSO_PKCE}}
redirect_uris:
- 'https://{{NAME}}.$DOMAIN/auth/callback'
- 'https://{{NAME}}.$DOMAIN{{SSO_CALLBACK}}'
scopes:
- 'openid'
- 'profile'
@@ -28,7 +27,7 @@ cat >> "$IDP" <<OIDC
- 'code'
grant_types:
- 'authorization_code'
token_endpoint_auth_method: 'client_secret_basic'
token_endpoint_auth_method: '{{SSO_TOKEN_AUTH}}'
userinfo_signed_response_alg: 'none'
### coreapp-{{NAME}} end
OIDC
+11
View File
@@ -1,3 +1,14 @@
# Register the client again if coreapp.toml's [sso] changed it (its
# callback, PKCE, or how it sends its secret); Authelia restarts only then
IDP=/federated/apps/authelia/data/config/idproviders.yml
BLOCK="$(sed -n '/^ ### coreapp-{{NAME}} begin$/,/^ ### coreapp-{{NAME}} end$/p' "$IDP")"
if ! grep -qxF " - 'https://{{NAME}}.$DOMAIN{{SSO_CALLBACK}}'" <<< "$BLOCK" \
|| ! grep -qxF " token_endpoint_auth_method: '{{SSO_TOKEN_AUTH}}'" <<< "$BLOCK" \
|| ! grep -qxF " $(echo "{{SSO_PKCE}}" | head -1)" <<< "$BLOCK" \
|| [ "$(grep -c pkce_challenge_method <<< "$BLOCK")" != "$(echo "{{SSO_PKCE}}" | grep -c pkce_challenge_method)" ]; then
. /federated/services/{{NAME}}/needs/sso/setup
fi
unset BLOCK
# Keep the copy of its Authelia client current (apps installed before
# copies were kept get one); Authelia's start restores clients from these
IDP=/federated/apps/authelia/data/config/idproviders.yml