Skip to content

feat(auth): support pluggable auth modes (aliyun/none/custom) for both consoles - #43

Merged
AlanFokCo merged 1 commit into
mainfrom
feat/pluggable-auth-modes
Nov 6, 2026
Merged

AlanFokCo merged 1 commit into
mainfrom
feat/pluggable-auth-modes

Conversation

@AlanFokCo

@AlanFokCo AlanFokCo commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Introduce a unified auth-mode switch to both ai-dashboard (admin console) and ai-dev-console (developer console), via AUTH_MODE env var, --auth-mode flag, or Helm auth.mode:

Mode Description Requires AK/SK
aliyun (default) Alibaba Cloud RAM OAuth2 SSO; unchanged behavior Yes
none No login; built-in admin identity with full permissions; no AK/SK or IMS client needed at startup; deploy-and-use No
custom Integrate a customer's own user system: trust identity headers injected by an upstream gateway (X-Forwarded-User / X-Forwarded-Groups), with admin user/group allowlists and an optional SSO login redirect No

Backwards compatible: legacy DISABLE_AUTH=true still works (mapped to none with a deprecation warning).

Main changes

  • Backends: new internal/auth/mode.go in both consoles; middleware dispatches on auth mode; non-aliyun modes skip credential provider / IMS client init and RAM WebApp creation; /login/aliyun redirects to the console home (none) or the configured SSO URL (custom)
  • Security fixes (piggybacked): WebSocket upgrade requests on dev-console reverse-proxy routes (notebook/vscode/tensorboard/ray) no longer skip the namespace check; K8s token login is disabled in custom mode so it cannot bypass the external IdP
  • Frontends: the 401 interceptor now follows the backend-provided loginUrl (external SSO) before falling back to the local login page
  • Charts: new auth.mode and auth.custom.* values in both charts; RAM WebApp creation is skipped automatically in non-aliyun modes; helm template verified for all three modes
  • Docs: new "Auth Modes" section in deploy-guide; README/user-guide/ops-guide updated
  • .gitignore: fixed the server rule shadowing the cmd/server/ Go entry points (both main.go files were never tracked before)

Verification

  • Independent adversarial evaluation (evaluator), three closure rounds, final verdict PASS: all 4 required conditions (mode switch / none deploy-and-use with full permissions / custom user-system integration / zero aliyun regression) verified with runtime evidence
  • go build + go test -count=1: all green in both modules (incl. 17 new test cases)
  • helm template: both charts render correctly in all three modes
  • Not covered: browser UI flow and real SSO gateway integration — recommend a post-deploy spot check

…h consoles

- Add AUTH_MODE env / --auth-mode flag (aliyun default, none, custom)
  to ai-dashboard and ai-dev-console backends
- none: no login, built-in admin with full permissions, no Aliyun
  credentials or IMS client required at startup (deploy-and-use);
  legacy DISABLE_AUTH=true still honored as an alias
- custom: integrate an external user system by trusting identity
  headers injected by an upstream gateway (X-Forwarded-User/Groups),
  with admin user/group lists and optional SSO login URL redirect;
  role/namespace scope resolved from User CRD per request
- dev-console: proxy routes (notebook/vscode/tensorboard/ray) enforce
  namespace checks for WebSocket upgrades too; K8s token login disabled
  in custom mode to avoid bypassing the external IdP
- frontends: 401 interceptor follows backend-provided loginUrl
- charts: wire auth.mode and auth.custom.* into both helm charts,
  auto skip RAM webapp creation when not in aliyun mode
- docs: auth modes section in deploy-guide; README/user-guide/ops-guide
  updates
- fix .gitignore so cmd/server/ Go entry points are tracked (they were
  shadowed by the 'server' binary rule and never committed)
@AlanFokCo
AlanFokCo merged commit de226a3 into main Nov 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants