Skip to content

Conversation

@ribaraka
Copy link
Contributor

@ribaraka ribaraka commented Dec 8, 2025

Motivation: cadence-workflow/cadence#6706
Plan&Findings: cadence-workflow/cadence#7508

This PR adds out-of-the-box RBAC support for the Cadence Web UI.

  • UI RBAC aligned with Cadence (backend) JWT auth: tokens come from cookie (cadence-authorization) or env (CADENCE_WEB_JWT_TOKEN), are forwarded on all gRPC calls, and claims/groups drive what the UI shows/enables.
  • Auth endpoints: POST /api/auth/token to set the HttpOnly cookie, DELETE /api/auth/token to clear it, GET /api/auth/me to expose public auth context.
  • User context middleware populates gRPC metadata and user info for all route handlers.
  • Domain visibility: getAllDomains filters by READ_GROUPS/WRITE_GROUPS. Redirects respect the filtered list.
  • Workflow/domain actions: start/signal/terminate/etc. are disabled with “Not authorized” when the token lacks write access;
  • Login/logout UI: navbar shows JWT paste modal when unauthenticated.

@ribaraka ribaraka force-pushed the rbac branch 2 times, most recently from 319273d to 42b3e1c Compare December 9, 2025 03:49
@ribaraka ribaraka changed the title Role based Cadence-web feat: Role based Cadence-web Dec 9, 2025
@ribaraka ribaraka force-pushed the rbac branch 3 times, most recently from 165520e to b1131fc Compare December 9, 2025 04:36
@ribaraka ribaraka force-pushed the rbac branch 3 times, most recently from 84cb2e7 to 9bd8868 Compare December 18, 2025 15:59
@ribaraka ribaraka marked this pull request as ready for review December 18, 2025 15:59
- UI RBAC aligned with Cadence JWT auth: tokens come from cookie (cadence-authorization) or env (CADENCE_WEB_JWT_TOKEN), are forwarded on all gRPC calls, and claims/groups drive what the UI shows/enables.
- Auth endpoints: POST /api/auth/token to set the HttpOnly cookie, DELETE /api/auth/token to clear it, GET /api/auth/me to expose public auth context.
- User context middleware populates gRPC metadata and user info for all route handlers.
- Domain visibility: getAllDomains filters by READ_GROUPS/WRITE_GROUPS. Redirects respect the filtered list.
- Workflow/domain actions: start/signal/terminate/etc. are disabled with “Not authorized” when the token lacks write access;
- Login/logout UI: navbar shows JWT paste modal when unauthenticated.

Signed-off-by: Stanislav Bychkov <stanislb@netapp.com>
simplified:
- deduplicate splitGroupList
- nav bar subtitle cleanup
- remove env CADENCE_WEB_JWT_TOKEN and its usage
- Adjust secure-cookie detection to be proxy/request driven and correctly parse `x-forwarded-proto`, avoiding `NODE_ENV` forcing secure cookies.
- Adopt Bearer-prefix stripping when setting the auth cookie
- Added Cache-Control: no-store headers to prevent stale auth responses:
- Treat tokens that fail JWT decoding as unauthenticated
- Avoid extra domain fetch when RBAC is off
@ribaraka
Copy link
Contributor Author

start page

rbac off:
image

rbac on:
image

@ribaraka
Copy link
Contributor Author

user menu (un-auth user):
image

input to enter a token:
image

added an admin token (domains are appeared + pop message):
image

user menu (after login):
image

added a reader user:
image

reader user inside a domain:
image

added a writer user:
image

writer user inside a domain:
image

user redirected to "start page" when token is expired:
image

@ribaraka
Copy link
Contributor Author

Unauthorised error messages are shown when user access protected domain
image

@ribaraka
Copy link
Contributor Author

@Assem-Hafez @demirkayaender, when you available, please review my initial version of the feature to ship with this PR.

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.

1 participant