feat(wiki): enrol every Authentik login into wiki-anwender
Decision sorb, and it was already made in #0049: normal Authentik users read the user documentation, admins are admins. The role model was implemented; the way in was not. selfRegistration created an account on first login and autoEnrollGroups was empty, so the account landed in no group at all - and since Guests is stripped of every permission, the user saw nothing and was told nothing about why. That is #0103, and it happened to a real person. Admins stay manual: membership in "authentik Admins" arrives through the groups claim and is not affected by this baseline. betrieb/* keeps its default deny, so the separation #0049 verified end to end still holds - it only stops applying to people who were never let in at all. The lookup aborts if wiki-anwender is missing rather than silently enrolling into nothing, which would reproduce the exact failure this fixes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ccf04608f5
commit
dfb88a375e
@@ -155,7 +155,7 @@ def login():
|
|||||||
return d["jwt"] if d["responseResult"]["succeeded"] else None
|
return d["jwt"] if d["responseResult"]["succeeded"] else None
|
||||||
|
|
||||||
|
|
||||||
def _set_strategies(jwt: str, oidc_config: list):
|
def _set_strategies(jwt: str, oidc_config: list, auto_enroll: list | None = None):
|
||||||
strategies = [
|
strategies = [
|
||||||
{ # local bleibt aktiviert: der Konfig-Job loggt sich damit ein und es ist der
|
{ # local bleibt aktiviert: der Konfig-Job loggt sich damit ein und es ist der
|
||||||
# Break-Glass-Zugang (/login?all). Auf der Login-Seite wird es per hideLocal
|
# Break-Glass-Zugang (/login?all). Auf der Login-Seite wird es per hideLocal
|
||||||
@@ -167,7 +167,16 @@ def _set_strategies(jwt: str, oidc_config: list):
|
|||||||
{
|
{
|
||||||
"key": STRATEGY_KEY, "strategyKey": "oidc", "displayName": "Authentik",
|
"key": STRATEGY_KEY, "strategyKey": "oidc", "displayName": "Authentik",
|
||||||
"order": 1, "isEnabled": True, "selfRegistration": True,
|
"order": 1, "isEnabled": True, "selfRegistration": True,
|
||||||
"domainWhitelist": [], "autoEnrollGroups": [], "config": oidc_config,
|
# autoEnrollGroups: jeder Authentik-Login landet in wiki-anwender
|
||||||
|
# (#0049: "Betrieb = Admin", Anwender lesen /anwender + Startseite).
|
||||||
|
# Ohne das legt selfRegistration zwar ein Konto an, es bekommt aber
|
||||||
|
# KEINE Gruppe - und weil Guests unten alle Rechte entzogen bekommt,
|
||||||
|
# sieht der Nutzer dann gar nichts und erfaehrt auch nicht warum
|
||||||
|
# (#0103, real passiert). Admins bleiben Handarbeit in Authentik:
|
||||||
|
# Mitgliedschaft in "authentik Admins" wird ueber den groups-Claim
|
||||||
|
# gemappt und ueberschreibt diese Grundausstattung nicht.
|
||||||
|
"domainWhitelist": [], "autoEnrollGroups": auto_enroll or [],
|
||||||
|
"config": oidc_config,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
r = gql(
|
r = gql(
|
||||||
@@ -193,8 +202,14 @@ def ensure_oidc(jwt: str):
|
|||||||
"groupsClaim": "groups", "mapGroups": True,
|
"groupsClaim": "groups", "mapGroups": True,
|
||||||
}
|
}
|
||||||
oidc_config = [{"key": k, "value": json.dumps({"v": v})} for k, v in cfg.items()]
|
oidc_config = [{"key": k, "value": json.dumps({"v": v})} for k, v in cfg.items()]
|
||||||
_set_strategies(jwt, oidc_config)
|
# Die Gruppe existiert hier sicher: main() legt sie vor ensure_oidc an.
|
||||||
log("OIDC-Strategy gesetzt (local bleibt aktiv als Break-Glass)")
|
anwender = group_id(jwt, "wiki-anwender")
|
||||||
|
if anwender is None:
|
||||||
|
sys.exit("ABBRUCH: Gruppe 'wiki-anwender' nicht gefunden — ohne sie liefe "
|
||||||
|
"jeder neue Login wieder ins Leere (#0103).")
|
||||||
|
_set_strategies(jwt, oidc_config, [anwender])
|
||||||
|
log(f"OIDC-Strategy gesetzt (local bleibt aktiv als Break-Glass; "
|
||||||
|
f"Auto-Enrollment in wiki-anwender, id {anwender})")
|
||||||
|
|
||||||
|
|
||||||
def set_hide_local(jwt: str):
|
def set_hide_local(jwt: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user