Skip to content

Auth UX: force password change, UI login + user management, full docker stack, ADMIN-role RBAC - #46

Merged
lekhrocks merged 3 commits into
mainfrom
feat/auth-complete
Aug 6, 2026
Merged

Auth UX: force password change, UI login + user management, full docker stack, ADMIN-role RBAC#46
lekhrocks merged 3 commits into
mainfrom
feat/auth-complete

Conversation

@lekhrocks

Copy link
Copy Markdown
Owner

Summary

Completes the auth experience end-to-end: first-login password change, a login + user-management UI, role-gated admin pages, the full local docker stack, and ADMIN-role RBAC. Builds on PR #45 (JWT auth).

Changes

Backend — first-login password change

  • V10 migration: must_change_password on app_users
  • UserService.create sets the flag (admin-provisioned accounts must set their own password); changePassword() re-encodes + clears it
  • AuthService.login returns LoginResult(token, mustChangePassword)
  • AuthController: /login returns the flag; new authenticated POST /auth/change-password

Backend — ADMIN-role RBAC

  • PolicyResolver: grant full permissions for the ADMIN role in addition to the admin username; AuthorizationService passes ctx.roles()
  • Resolves the UI/backend inconsistency: the UI gates admin pages on the ADMIN role; the backend now honors it too (not just the username)

UI

  • Login flow: AuthContext (token in localStorage, bearer injection, /auth/me hydration, roles/isAdmin), LoginPage, ChangePasswordPage
  • User management: UsersPage (list, roles, enable toggle, create modal, delete) + userApi/authApi
  • Admin gating: AdminRoute wrapper + adminOnly nav items so non-ADMIN users see neither the nav nor the routes (/users, /agents, /admin)

Docker

  • Required: postgres + app (JRE, JWT secret, healthchecks, ddl validate)
  • Optional connectors profile: mysql (binlog ROW for Debezium), mongodb, redis
  • Optional kafka profile: zookeeper + kafka wired to the app

Validation

  • Full ./gradlew test green
  • UI: tsc --noEmit, vite build, eslint clean (0 errors)
  • docker compose config valid

- V10 migration: must_change_password on app_users
- UserEntity/UserService: new accounts set mustChangePassword; changePassword()
  re-encodes and clears the flag
- AuthService.login returns LoginResult(token, mustChangePassword)
- AuthController: /login returns mustChangePassword; POST /auth/change-password
  sets a new password for the authenticated caller
- PolicyResolver: grant full perms for the ADMIN role as well as the 'admin'
  username (overload accepts roles; AuthorizationService passes ctx.roles())
- RbacUnitTest: adminRoleGrantsAllPermissions; AuthServiceTest/UserServiceTest
  cover the flag and change flow
…ting

- AuthContext: token in localStorage, bearer injection via setAuthToken,
  /auth/me hydration, roles/isAdmin derived from the user's roles
- LoginPage: JWT login form
- ChangePasswordPage: first-login password change for provisioned accounts
- UsersPage: user list (roles/enabled), create modal, toggle, delete
- authApi/userApi services + User/Login types
- App.tsx: auth guard (login/change-password/loading gates), AdminRoute
  wrapper; AppLayout: adminOnly nav items hidden for non-ADMIN roles
- main.tsx: wrap in AuthProvider
- postgres + app (required): app on 25-jre-alpine with JWT secret, healthchecks,
  start_period, ddl validate (drops the missing docker profile)
- connector profile: mysql (binlog ROW for Debezium CDC), mongodb, redis
- kafka profile: zookeeper + kafka wired to the app
- header documents required vs opt-in profiles
@lekhrocks lekhrocks self-assigned this Aug 5, 2026
@lekhrocks
lekhrocks merged commit 4e1fd4b into main Aug 6, 2026
18 checks passed
@lekhrocks
lekhrocks deleted the feat/auth-complete branch August 6, 2026 03:08
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