Documentation
¶
Overview ¶
Package iam2 mounts the clean-room Hanzo IAM v2 (zip-native, beego-free) into the unified hanzoai/cloud binary as the identity plane, selected OVER the legacy beego Casdoor embed (clients/iam) by CLOUD_IAM_IMPL=iam2. It is the either/or twin of clients/iam: both own the SAME absolute prefixes (/v1/iam/*, /login/oauth/*), so they CANNOT co-mount — EXACTLY ONE is wired per boot (apps.Wire → identitySpec). Default (CLOUD_IAM_IMPL unset) keeps the beego embed, so this package is completely inert until the flag flips — safe to land in a churning main.
WHY iam2 is NOT staged like iam. "iam" is staged because iamserver.InitEmbed boots the WHOLE Beego runtime and mutates process-global Beego state (web.BeeApp / the shared AppConfig), which corrupts the sibling `ai` casdoor fork under mount-all. iam2 carries NO such process-global: it opens its OWN orm.DB and registers zip-native routes, so the shared-global hazard that pins iam to staged does not exist here. The deliberate CLOUD_IAM_IMPL=iam2 opt-in is itself the gate.
FAIL-CLOSED, NOT FAIL-LOUD. A store-open or mount failure degrades THIS subsystem to a 503 on the identity prefixes (mountFailClosed) while every co-resident subsystem (KMS, o11y, ...) stays up — the fold's blast-radius isolation. It never panics the shared binary (iam2server.Mount's only panic path — a registered enterprise feature failing to mount — is recovered in safeMount).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
Mount opens iam2's embedded store, seeds config from the same init_data.json the beego iam uses (non-fatal), and registers the whole iam2 surface onto cloud's shared zip.App. It matches the cloud.Typed contract (func(*zip.App, cloud.Deps) error) so apps.Wire references it via cloud.Typed exactly like clients/iam.Mount — cloud hands subsystems a cloud.Deps, not an orm.DB, so iam2 opens its own store here.
Types ¶
This section is empty.