Wrong, blank or failed logins all answer the same 401. A deactivated admin is refused and the token services-auth issued is revoked. resetAdminPassword now refuses deactivated users and users without an email. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
5.7 KiB
5.7 KiB
Tasks
Babyboo source: ~/Projects/babyboo (read only). All tasks run serially; most touch shared security code or build files.
1. Database
- 1.1 Write
sql/01-company.sql(createcompany, add nullableuser.company_id, insert company 1 'Co-Lite'),sql/02-bo-modules.sql(40000000 BO_ROOTR,40700000 BO_USERS/users,40800000 BO_ROLES/roles, areaBO) andsql/99-rollback.sqlin this change folder. Mirror them intolocal/seed/(03-colite.sqlsetscompany_id = 1on the dev admin;02-reference.sqlkeeps only roles 1, 2, 3 and theirmodules_rolesrows). Verify:docker compose -f local/docker-compose.yml down -v && local/up.shexits 0, and a read-only SELECT shows the admin with company 1, the three BO modules and three roles.- Scope:
openspec/changes/add-admin-auth-users-roles/sql/**,local/seed/**
- Scope:
2. services-system
- 2.1 Add
companyIdtoservices-systemUser(columncompany_id) and make/user/savekeep it. Test first: saving a user withcompanyId1 and reading it back returns 1; saving an existing user withoutcompanyIddoes not clear it. Verify:mvn -T 1C -pl solvway-services-system -am verify.- Scope:
solvway-services-system/src/**
- Scope:
3. mobile-api admin guard
- 3.1 Port
AdminModule,AdminModuleAccess,AdminSessionGuardand the admin branch of babyboo'sAppAccessAspect(admin-path detection, admin-token check via/auth/findUserByToken/BO/{token}, revocation, deactivated and pending-reset handling,requireAdminModulewith super-admin bypass, fail closed) into Co-Lite'sAppAccessAspect, without country scope or audit. Port babyboo's tests for these classes and add tests for everyadmin-access"Admin endpoint guard" and "Logout" scenario plus: deactivated token gives 401, pending reset gives 403 except first-login and logout, undeclared handler denied to non-super admin. Verify:mvn -T 1C -pl solvway-mobile-api -am verify.- Scope:
solvway-mobile-api/src/main/java/**/useraccess/**,solvway-mobile-api/src/test/java/**/useraccess/**,solvway-mobile-api/src/main/resources/application*.yml
- Scope:
4. mobile-api admin auth
- 4.1 Port babyboo's
AdminAuthControllerandAdminAuthenticationService(login, first-login, logout, refresh, me) onto Co-Lite endpoints, and addPOST /api/admin/auth/forgot-passwordcalling/user/resetAdminPassword. Login answers 401 for an empty token, a deactivated user or a non-admin account; forgot-password always answers 200. Port babyboo's tests for these classes and add one peradmin-accesslogin, first-login and forgot-password scenario. Verify:mvn -T 1C -pl solvway-mobile-api -am verify.- Scope:
solvway-mobile-api/src/**/controller/admin/**,solvway-mobile-api/src/**/service/admin/**,solvway-mobile-api/src/**/dto/admin/**(or babyboo's equivalent packages)
- Scope:
5. mobile-api users and roles
- 5.1 Port
AdminUserControllerandAdminUserService: admin-only list with search, filter and sort; create with temporary password, email and company from the logged-in admin; edit; deactivate with self-deactivation refused; admin-triggered reset via/user/resetAdminPassword. Tests first for eachadmin-usersscenario. Verify:mvn -T 1C -pl solvway-mobile-api -am verify.- Scope: as 4.1
- 5.2 Port
AdminRoleController,AdminRoleServiceandAdminAclService(role list hidingROLE_MEMBER, create and rename with unique names,GET/PUT /roles/{id}/modulesreplacing grants, self lock-out refused, super admin grants not editable). Tests first for eachadmin-rolesscenario. Verify:mvn -T 1C -pl solvway-mobile-api -am verify.- Scope: as 4.1
6. Admin portal
- 6.1 Cut the portal down to login, reset-password (first login), users, roles, roles access, not-authorised and the app shell: delete every other
app/route,app/api/family, component folder, lib file and test, then removepackage.jsondependencies with no remaining import and their i18n keys. CutrouteModulesandFIXED_PROTECTED_MODULE_NAMEStoBO_ROOT,BO_USERS,BO_ROLES; default cookiecolite_admin; replace babyboo branding text. Verify: insolvway-admin-portal,npm ci && npm run lint && npm run build && npm testall exit 0.- Scope:
solvway-admin-portal/**
- Scope:
- 6.2 Add the
/forgot-passwordpage (public, linked from login) and its route handler calling/api/admin/auth/forgot-password, showing the fixed message for any outcome; make the users form refuse self-deactivation and show duplicate-username and lock-out errors from the API. Tests first (vitest) for each portal-visible scenario in the specs. Verify:npm run lint && npm run build && npm testexit 0.- Scope:
solvway-admin-portal/**
- Scope:
7. Local stack and end-to-end check
- 7.1 Update
local/smoke.shto log in viaPOST :8080/api/admin/auth/loginand call/api/admin/meand/api/admin/users(keep the counter read and the public call); add the portal to the README run steps (npm run devwithMOBILE_API_BASE_URL=http://localhost:8080and the app key). Verify: freshlocal/up.shthenlocal/smoke.shprintssmoke: OK.- Scope:
local/smoke.sh,local/README.md,local/.env.example
- Scope:
- 7.2 Drive the portal in a browser with Playwright against the local stack: login (correct and wrong password), first-login change for a new user, users list/create/edit/deactivate, roles create and grant
BO_USERS, not-authorised page for a user withoutBO_ROLES, forgot-password message. Screenshots in the change folder'sverification/. Only local dev data is created. Verify: each scenario observed as specified.- Scope:
openspec/changes/add-admin-auth-users-roles/verification/**
- Scope:
Workflow follow-up
- Code review, PR to
main, merge, then archive this change.