Commit Graph

75 Commits

Author SHA1 Message Date
admin 2bbbb02d5a updated package 2026-06-08 13:06:58 +08:00
admin a6666ff7da added back off and log fatal 2026-05-21 08:03:10 +08:00
admin d13f9bced8 Merge branch 'main' of https://collab-core.psa.gov.ph/psa/uess/authz 2026-04-29 10:56:26 +08:00
admin 3a84752c3e fixed 2026-04-29 10:54:41 +08:00
admin 49dfc0e4d7 Edit Jenkinsfile 2026-04-29 10:15:49 +08:00
admin c1e1aa5688 Add new file 2026-04-29 10:14:16 +08:00
admin 8c83383344 fixed region fetching in user_attributes 2026-04-16 14:46:56 +08:00
admin 691dabfb26 fixed region fetching in user_attributes 2026-04-16 14:46:33 +08:00
admin 29cf10c379 fixed region fetching in user_attributes 2026-04-16 13:42:50 +08:00
admin f0bc603a5f fixed region fetching in user_attributes 2026-03-24 16:38:41 +08:00
admin 7847206283 changed to authz 2026-03-24 16:37:33 +08:00
admin 65ba8beb69 added jenkinsfile 2026-03-24 16:36:16 +08:00
admin bb6ec52732 added db name 2026-03-12 17:41:39 +08:00
admin 52fa1f4818 added nosec since it's just a namespace prefix 2026-03-09 13:06:15 +08:00
admin 8ca995d490 fixed authorization (now checks the role inside of the project) 2026-03-02 13:46:14 +08:00
admin e32a4a2779 adjusted the authz 2026-03-02 13:23:39 +08:00
admin 7ac6df55c3 added additional_role_id when checking the roles 2026-02-27 14:04:43 +08:00
admin 20bd509bba added additional_role_id when checking the roles 2026-02-27 14:03:29 +08:00
admin 3ac1f83dd4 added more error logs 2026-02-27 10:18:38 +08:00
admin 6262c875b7 feat(authz): support multi-role claim evaluation and role-aware permission checks
Parse and normalize user and project role claims (role_id + projects[].role_id)
Intersect requested roles with JWT-available roles before authorization
Evaluate permissions across candidate roles in both cached and non-cached flows
Fix claim field fallbacks (user_id/email) and role ID log formatting
Update tests and SQL mock expectations for new role-resolution behavior
2026-02-27 08:39:33 +08:00
admin ae1831e61f feat: standardize field names and add flexible role_id handling for JWT compatibility
- Rename user_id → users_id across all models, handlers, services, and tests
- Add custom RoleIDs type supporting string/int/array unmarshaling (e.g., "1", 1, [1])
- Implement flexible JSON unmarshaling for JWT Claims to handle field name variants
  - Support both user_id/users_id and email/email_address field names
  - Enable role_id as string ("1"), int (1), or array ([1,2])
- Update AuthorizationContext to handle role_id type flexibility
- Add comprehensive logging to repository, service, and handler layers
  - Entry/exit logs with full context
  - Success (✓) and failure (✗) indicators
  - Step-by-step authorization flow tracking
- Add containsRole helper for multi-role membership checks
- Fix database queries: user_id → users_id, id → permissions_id
- Update all tests to use models.RoleIDs{} syntax
- Change GetRole middleware return type: string → []int
- Maintain backward compatibility with legacy JWT tokens

This change improves integration with external services (MIS) that may send
role_id in different formats and standardizes field naming conventions
throughout the authorization microservice.
2026-02-03 16:35:16 +08:00
admin 97f1ef5f07 fixed 2026-01-29 17:24:20 +08:00
admin c7ee14f6a1 fixed 2026-01-29 17:23:58 +08:00
admin d5606b34f9 fixed ABAC 2026-01-29 11:43:22 +08:00
admin 3abaf6f592 removed simple check 2026-01-29 09:33:50 +08:00
admin 6d8a2faf25 fixed message 2026-01-27 13:14:22 +08:00
admin bd0fdf89f3 fix test files 2026-01-27 10:45:15 +08:00
admin 8b589e5a55 added skipping of policy evaluation for super and system admin 2026-01-27 10:13:50 +08:00
admin 71923eb634 add unresolved placeholders 2026-01-27 10:13:15 +08:00
admin 84fa6a5bb5 add logging 2026-01-27 10:12:25 +08:00
admin 35a19a88db add logging 2026-01-27 10:12:06 +08:00
admin 8496466690 remove role_dps in query 2026-01-27 10:11:28 +08:00
admin 8de7bba8a4 remove fields in model 2026-01-27 10:11:11 +08:00
admin c4a7719ca5 setting of context roleid from claims 2026-01-27 10:10:41 +08:00
admin 871b92b3d8 removed role_dps 2026-01-27 10:02:15 +08:00
admin 7a5c66c857 fixed permission_reposity queries 2026-01-27 10:01:22 +08:00
admin 9a40ac5529 removed schema 2026-01-27 09:21:57 +08:00
admin 0f5ca8ee34 added another test 2026-01-27 09:21:22 +08:00
admin 6f64cb9766 removed role dps in query and change address to home address in query 2026-01-27 09:21:04 +08:00
admin 8cf43a9c64 removed account type and home address 2026-01-27 09:20:29 +08:00
admin 4c190a2fff added another test 2026-01-27 09:20:05 +08:00
admin a36f652a1c remove docs 2026-01-27 09:19:53 +08:00
admin 7349ed4e1b updated
instead middle_name it's middle_initial
2026-01-22 14:13:09 +08:00
admin 1a68840805 fix(auth)!: implement proper RBAC with role-permission checking
BREAKING CHANGE: Authorization now requires role_permissions table

Previously checked only if permission existed, now verifies user's
role has been granted the permission. Closes critical security gap
allowing any user to access any resource.

- feat: add role_permissions table schema
- feat: add GetPermissionByResourceActionAndRole repository method
- fix: update Authorize to check user role before granting access
- fix: update cache keys to include roleID
- test: update all tests for new authorization flow
2026-01-22 14:09:37 +08:00
admin 509a502a85 removed username 2026-01-16 10:50:50 +08:00
admin a361140629 fixed 2026-01-05 15:59:13 +08:00
admin 909790a423 fixed 2026-01-05 14:06:43 +08:00
admin 3075a1ece5 added logging 2026-01-05 14:04:07 +08:00
admin 15a125ca12 added logging 2026-01-05 14:03:58 +08:00
admin 60ef06219b added a simple check route 2026-01-05 14:03:51 +08:00