docs: record admin guard details found while building task 3.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
0a990cbcaf
commit
1bfc1c73c6
1 file changed
+1
-1
@@ -29,7 +29,7 @@ Alternative: write admin controllers fresh against Tastefully's backoffice contr
|
||||
|
||||
### 2. Admin token check uses `findUserByToken/BO`
|
||||
|
||||
On an `/api/admin/**` path the aspect loads the user with `/auth/findUserByToken/BO/{token}`. No user, or a non-admin user, means 403 for a valid member token and 401 for a revoked token. The same lookup gives the roles for the module check and the enabled and login-status flags for the session guard (deactivated means 401; pending password change allows only first-login and logout, otherwise 403). This is one downstream call per admin request.
|
||||
On an `/api/admin/**` path the aspect first reads the token's `USERTYPE` claim: anything but `A` is a 403. It then loads the user with `/auth/findUserByToken/BO/{token}`; no user (unknown or logged out) is a 401. `findUserByToken` did not check the logout list, so this change makes it return no user for a logged-out token, and adds `BO` to the `Area` enums in core-libs and services-system. `findUserByToken` also adds `ROLE_ADMIN` (id 2) to every admin, so the module check ignores role 2. The pending-reset 403 carries `code: PASSWORD_RESET_REQUIRED`, which the portal uses to redirect. The same lookup gives the roles for the module check and the enabled and login-status flags for the session guard (deactivated means 401; pending password change allows only first-login and logout, otherwise 403). This is one downstream call per admin request.
|
||||
|
||||
`ponytail:` no cache on this lookup; add a short-TTL cache keyed by token if admin latency matters.
|
||||
|
||||
|
||||
Reference in new issue
Block a user