Merge pull request 'Vipps Login as a sign-in provider in Rauthy, kept by the deploy' (#10) from rauthy-vipps-login into main
deploy / deploy (push) Failing after 6s
deploy / deploy (push) Failing after 6s
Reviewed-on: #10
This commit was merged in pull request #10.
This commit is contained in:
commit
97083982ba
3 files changed
+49
-1
No files matched your search
@@ -167,3 +167,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Pull and bring the stack up
|
- name: Pull and bring the stack up
|
||||||
run: sudo /usr/local/bin/deploy-tomtervel
|
run: sudo /usr/local/bin/deploy-tomtervel
|
||||||
|
|
||||||
|
# The sign-in providers Rauthy offers (Vipps Login), kept by the
|
||||||
|
# deploy through Rauthy's API: rauthy-providers.sh. Unset values
|
||||||
|
# change nothing.
|
||||||
|
- name: Sign-in providers in Rauthy
|
||||||
|
env:
|
||||||
|
VIPPS_LOGIN_CLIENT_ID: ${{ vars.VIPPS_LOGIN_CLIENT_ID }}
|
||||||
|
VIPPS_LOGIN_CLIENT_SECRET: ${{ secrets.VIPPS_LOGIN_CLIENT_SECRET }}
|
||||||
|
run: ./rauthy-providers.sh
|
||||||
@@ -123,6 +123,7 @@ Run workflow**. Set them with `gt` (`gt variable set NAME --body ...`,
|
|||||||
| `OIDC_ISSUER` | variable | repo | where the site and the chat sign in: `https://konto.tomtervel.no/auth/v1/` |
|
| `OIDC_ISSUER` | variable | repo | where the site and the chat sign in: `https://konto.tomtervel.no/auth/v1/` |
|
||||||
| `RAUTHY_BOOTSTRAP_API_KEY`, `RAUTHY_BOOTSTRAP_API_KEY_SECRET` | secret | repo | optional, Rauthy's first start only: a short-lived key (base64 of `{"name","exp","access"}`, secret 64+ alphanumerics) that makes the OIDC clients through the API; read into an empty database, ignored after |
|
| `RAUTHY_BOOTSTRAP_API_KEY`, `RAUTHY_BOOTSTRAP_API_KEY_SECRET` | secret | repo | optional, Rauthy's first start only: a short-lived key (base64 of `{"name","exp","access"}`, secret 64+ alphanumerics) that makes the OIDC clients through the API; read into an empty database, ignored after |
|
||||||
| `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE` | secret, variable | repo | portal makes accounts in Rauthy (`<name>$<secret>`, made in Rauthy's admin), in `nb` |
|
| `RAUTHY_API_KEY`, `RAUTHY_LANGUAGE` | secret, variable | repo | portal makes accounts in Rauthy (`<name>$<secret>`, made in Rauthy's admin), in `nb` |
|
||||||
|
| `VIPPS_LOGIN_CLIENT_ID`, `VIPPS_LOGIN_CLIENT_SECRET` | variable, secret | repo | Vipps Login (the login sales unit's keys from portal.vippsmobilepay.no): the deploy keeps Vipps as a sign-in provider in Rauthy with them (`rauthy-providers.sh`) |
|
||||||
|
|
||||||
A variable is printed wherever a workflow echoes it, and this repo's run
|
A variable is printed wherever a workflow echoes it, and this repo's run
|
||||||
logs are public: a value that must not be read is a secret.
|
logs are public: a value that must not be read is a secret.
|
||||||
@@ -162,7 +163,7 @@ On a new host:
|
|||||||
`refresh_token`, redirect `https://samtaler.tomtervel.no/auth/callback`),
|
`refresh_token`, redirect `https://samtaler.tomtervel.no/auth/callback`),
|
||||||
their secrets into `OAUTH2_CLIENT_SECRET` and
|
their secrets into `OAUTH2_CLIENT_SECRET` and
|
||||||
`CHAT_OAUTH2_CLIENT_SECRET`, and an API key `portal` with read,
|
`CHAT_OAUTH2_CLIENT_SECRET`, and an API key `portal` with read,
|
||||||
create and update on users, groups and roles into `RAUTHY_API_KEY`
|
create and update on users, groups, roles and auth providers into `RAUTHY_API_KEY`
|
||||||
(a committee's leaders get a role that goes with managing it). A key
|
(a committee's leaders get a role that goes with managing it). A key
|
||||||
Rauthy no longer knows, or one past its expiry, answers 401 to
|
Rauthy no longer knows, or one past its expiry, answers 401 to
|
||||||
everything, and every invite fails ("the account could not be made
|
everything, and every invite fails ("the account could not be made
|
||||||
|
|||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# The sign-in providers Rauthy offers beside its own accounts, as the
|
||||||
|
# deploy keeps them: today Vipps Login. Rauthy has no file for this, only
|
||||||
|
# its API, so this script is the file: run on every deploy, it makes the
|
||||||
|
# provider the first time and updates it after, by name, so a change here
|
||||||
|
# is a change in Rauthy. Needs RAUTHY_HOST, RAUTHY_API_KEY (AuthProviders
|
||||||
|
# read/create/update), VIPPS_LOGIN_CLIENT_ID and VIPPS_LOGIN_CLIENT_SECRET;
|
||||||
|
# with any of them unset it changes nothing and says so.
|
||||||
|
#
|
||||||
|
# Vipps's side: the sales unit's Vipps Login must have the redirect URI
|
||||||
|
# https://<RAUTHY_HOST>/auth/v1/providers/callback registered, or every
|
||||||
|
# sign-in is refused there.
|
||||||
|
set -euo pipefail
|
||||||
|
for v in RAUTHY_HOST RAUTHY_API_KEY VIPPS_LOGIN_CLIENT_ID VIPPS_LOGIN_CLIENT_SECRET; do
|
||||||
|
[ -n "${!v:-}" ] || { echo "rauthy-providers: $v is not set; nothing changed"; exit 0; }
|
||||||
|
done
|
||||||
|
base="https://$RAUTHY_HOST/auth/v1"
|
||||||
|
auth="Authorization: API-Key $RAUTHY_API_KEY"
|
||||||
|
vipps=$(jq -n --arg id "$VIPPS_LOGIN_CLIENT_ID" --arg secret "$VIPPS_LOGIN_CLIENT_SECRET" '{
|
||||||
|
name: "Vipps", typ: "custom", enabled: true,
|
||||||
|
issuer: "https://api.vipps.no/access-management-1.0/access/",
|
||||||
|
authorization_endpoint: "https://api.vipps.no/access-management-1.0/access/oauth2/auth",
|
||||||
|
token_endpoint: "https://api.vipps.no/access-management-1.0/access/oauth2/token",
|
||||||
|
userinfo_endpoint: "https://api.vipps.no/vipps-userinfo-api/userinfo",
|
||||||
|
jwks_endpoint: "https://api.vipps.no/access-management-1.0/access/.well-known/jwks.json",
|
||||||
|
client_id: $id, client_secret: $secret, client_secret_basic: true, client_secret_post: false,
|
||||||
|
scope: "openid name email phoneNumber", use_pkce: true, danger_allow_insecure: false, root_pem: null,
|
||||||
|
admin_claim_path: null, admin_claim_value: null, mfa_claim_path: null, mfa_claim_value: null,
|
||||||
|
auto_onboarding: true, auto_link: false }')
|
||||||
|
# Listing is a POST in Rauthy's API.
|
||||||
|
existing=$(curl -sf -X POST -H "$auth" -H 'content-type: application/json' -d '{}' "$base/providers" | jq -r '.[] | select(.name == "Vipps") | .id' | head -n1)
|
||||||
|
if [ -n "$existing" ]; then
|
||||||
|
curl -sf -X PUT -H "$auth" -H 'content-type: application/json' -d "$vipps" "$base/providers/$existing" >/dev/null
|
||||||
|
echo "rauthy-providers: Vipps updated ($existing)"
|
||||||
|
else
|
||||||
|
id=$(curl -sf -X POST -H "$auth" -H 'content-type: application/json' -d "$vipps" "$base/providers/create" | jq -r .id)
|
||||||
|
echo "rauthy-providers: Vipps made ($id)"
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user