coreapp new --sso: sign-in through the Core's Authelia
A template overlay (templates/sso) registers the app as an OpenID Connect client in Authelia's idproviders.yml (between markers, secret hashed by the running Authelia), checks the configuration before restarting Authelia and restores it if the check fails; uninstall removes the client. The app reaches Authelia's https address through traefik (@TRAEFIK_IP@, provided by the template's install and by redeploys). The example is a standard-library Python OIDC client (code flow with PKCE). Tested by install, redeploy, remove and reinstall, and a real sign-in in a browser. Also: the postgres overlay appends to the base install, uninstall and env.in; database names get a coreapp_ prefix (PostgreSQL reserves pg_*); deploy waits until the app answers on its own address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
|
||||
# Its own database and user on the Core's PostgreSQL (DEPENDS=postgresql),
|
||||
# with the password from .env. Safe to run again: an existing user gets the
|
||||
# password, an existing database is kept.
|
||||
DB_PASSWORD="$(sed -n 's/^DB_PASSWORD=//p' /federated/apps/{{NAME}}/.env)"
|
||||
if docker exec postgresql psql -U postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname = '{{DBNAME}}'" | grep -q 1; then
|
||||
docker exec postgresql psql -U postgres -qc "ALTER USER {{DBNAME}} WITH PASSWORD '$DB_PASSWORD'"
|
||||
else
|
||||
docker exec postgresql psql -U postgres -qc "CREATE USER {{DBNAME}} WITH PASSWORD '$DB_PASSWORD'"
|
||||
fi
|
||||
if ! docker exec postgresql psql -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '{{DBNAME}}'" | grep -q 1; then
|
||||
docker exec postgresql psql -U postgres -qc "CREATE DATABASE {{DBNAME}} OWNER {{DBNAME}}"
|
||||
fi
|
||||
unset DB_PASSWORD
|
||||
Reference in New Issue
Block a user