add arrstack oauth app + per-app access groups #18
Reference in New Issue
Block a user
Delete Branch "benvin/arrstack-oauth"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
arrproxy(a Go service) will be the single front door for the media stack at https://arrstack.unkin.net, fronted by an oauth2-proxy sidecar doing Authentik OIDC. After login, arrproxy derives which backend apps (sonarr, radarr, prowlarr) a user may reach from the user's Authentik group membership carried in the OIDC groups claim (oauth2-proxy passes it as X-Auth-Request-Groups). This adds the Authentik OIDC application for that front door plus the per-app entitlement groups it reads.Changes
config/providers_oauth2/arrstack.yaml: confidential oauth2 clientclient_id: arrstack, litellm-style authorization/invalidation flows,client_secretfrom Vault kvkubernetes/namespace/arrstack/default/oauth-credentials, openid/email/profile scopes, redirecthttps://arrstack.unkin.net/oauth2/callback, launchhttps://arrstack.unkin.net/. The module unconditionally attaches the estate hierarchicalak_groupsscope mapping, so this front door emits the groups claim.config/permissions/akP-arrstack-user.yaml: front-door access gate (application: arrstack) — only members of this permission (or a role nesting it) can complete OIDC to the arrstack app.config/permissions/akP-arrstack-{sonarr,radarr,prowlarr}.yaml: per-app entitlements, deliberately unbound (noapplication) so they never gate OIDC and exist only to surface in the user'sak_groupsclaim for arrproxy to authorize the matching backend.config/roles/akR-arrstack-user.yaml: full-media role nesting the front door + all three per-app perms. Narrower access = assign individualakP-arrstack-<app>perms (plusakP-arrstack-user) to a user directly.config/roles/akR-global-admin.yaml: also nests the arrstack front door + all per-app perms (arrstack has no admin tier; this gives global admins full media access).How per-app access reaches arrproxy
The estate
ak_groups(hierarchical) scope mapping walks each of a user's groups up through.parentsand emits the union of group names. A member ofakR-arrstack-usertherefore gets anak_groupsclaim containing:akR-arrstack-user,akP-arrstack-user,akP-arrstack-sonarr,akP-arrstack-radarr,akP-arrstack-prowlarr.arrproxy/oauth2-proxy must request the
ak_groupsscope and read theak_groupsclaim (oauth2-proxy--oidc-groups-claim=ak_groups), then mapakP-arrstack-sonarr-> sonarr,-radarr-> radarr,-prowlarr-> prowlarr. The three managed openid/email/profile scopes alone do NOT carry groups; theak_groupsscope is required on the token request.Out-of-band before apply
Seed Vault kv
kv/kubernetes/namespace/arrstack/default/oauth-credentialswithclient_secret(and the deploy-sideclient_id/cookie_secretfor oauth2-proxy) — Terraform only readsclient_secret. Not applied here.Validation
yamllint (repo relaxed profile) passes; no trailing whitespace. No apply.