Commit 4e937a3
Implement full ABAC (Attribute-Based Access Control) system with unified policy evaluation and Keycloak attribute management UI (#31)
* Initial plan
* Add custom attributes support for LimitAccess annotation
- Added customAttributes field to LimitAccess annotation
- Updated AccessLimitations DTO to include custom attributes
- Enhanced AccessControlAspect to validate custom attributes against user attributes
- Created CustomAttributeMapping model, repository, and service for managing mappings
- Added REST API endpoints for CRUD operations on custom attribute mappings
- Created modern UI for managing custom attribute mappings
- Added database migration for custom_attribute_mappings table
- Integrated with existing UserAttributeService for attribute validation
Co-authored-by: phrocker <[email protected]>
* Add comprehensive tests for custom attribute functionality
- Added CustomAttributeMappingServiceTest with 17 test cases
- Added AccessControlAspectCustomAttributeTest with 10 test cases
- Tests cover happy path, edge cases, validation, and error handling
- All tests passing (91 tests run, 0 failures)
Co-authored-by: phrocker <[email protected]>
* Add comprehensive documentation for custom attribute mappings feature
- Created detailed CUSTOM_ATTRIBUTE_MAPPINGS.md with usage examples
- Documented REST API endpoints and request/response formats
- Added quick start guide and configuration instructions
- Included use cases, troubleshooting, and best practices
- Added security considerations and performance notes
Co-authored-by: phrocker <[email protected]>
* Fix UserAttributeService dependency injection in AccessControlAspect
- Changed UserAttributeService from required constructor parameter to optional @lazy field injection
- Added null check in checkCustomAttribute method to handle cases where service is not available
- Removed @requiredargsconstructor and manually created constructor
- This resolves the KeycloakManager bean creation issue during application startup
- All tests passing (91/91)
Co-authored-by: phrocker <[email protected]>
* fix kafka deployment
* Fix layout and add navigation for custom attribute mappings UI
- Fixed page layout to use proper container-fluid structure with sidebar
- Changed from simple container to row/column layout matching other pages
- Added "Custom Attributes" menu item to sidebar under CAN_MANAGE_APPLICATION
- Positioned between Trust Policies and Telemetry for better organization
- Fixed CSS positioning to prevent content appearing below menu
- Build successful and ready for deployment
Co-authored-by: phrocker <[email protected]>
* Fix attribute endpoint
* Add core ABAC models and PolicyEvaluator service
- Created AttributeDefinition model for unified attribute schema across all scopes (SUBJECT, RESOURCE, ACTION, ENVIRONMENT)
- Created AttributeAssignment model for binding attributes to users, roles, endpoints, data entities
- Created AccessPolicy model for defining ABAC policies with priority and rule combination
- Created PolicyRule model for individual attribute conditions within policies
- Implemented PolicyEvaluator service as centralized evaluation engine
- Added EvaluationContext for subject/resource/action/environment attributes
- Added PolicyDecision for evaluation results
- Created repositories for all ABAC models
- Added database migration V30 for ABAC tables with indexes
- Build successful, ready for integration work
Co-authored-by: phrocker <[email protected]>
* Integrate PolicyEvaluator with AccessControlAspect and add ABAC services
- Integrated PolicyEvaluator into AccessControlAspect for ABAC-based attribute checking
- Added lazy-loaded PolicyEvaluator field to avoid circular dependencies
- Refactored checkCustomAttribute to use PolicyEvaluator when available, fallback to UserAttributeService
- Created AttributeManagementService for managing attribute definitions and assignments
- Implemented Keycloak sync method (syncUserAttributesFromKeycloak) for bidirectional attribute updates
- Created CustomAttributeMigrationService to migrate legacy CustomAttributeMapping to ABAC policies
- Added migration status tracking and automated policy generation from mappings
- All 91 tests passing with new ABAC integration
Co-authored-by: phrocker <[email protected]>
* Add ABAC REST API endpoints for policy management and migration
- Created DTOs for AccessPolicy, PolicyRule, and AttributeDefinition
- Implemented AccessPolicyController with CRUD operations
- Added migration endpoint (POST /api/v1/abac/policies/migrate)
- Added migration status endpoint (GET /api/v1/abac/policies/migration/status)
- Added policy listing (GET /api/v1/abac/policies)
- Added policy details and rules (GET /api/v1/abac/policies/{id} and {id}/rules)
- All endpoints protected with CAN_MANAGE_APPLICATION permission
- Build successful across all modules
Co-authored-by: phrocker <[email protected]>
* Complete Phase 2: Add tests, scheduler, and comprehensive ABAC documentation
- Added PolicyEvaluatorTest with 6 comprehensive test cases
- Added AttributeManagementServiceTest with 9 test cases covering all service methods
- Created KeycloakAttributeSyncScheduler for periodic attribute synchronization
- Added ABAC_IMPLEMENTATION_GUIDE.md with complete usage examples and best practices
- All 103 tests passing (12 new ABAC tests added)
- Build successful across all 15 modules
- Phase 2 now 100% complete
Co-authored-by: phrocker <[email protected]>
* Add comprehensive Keycloak attribute management UI and REST APIs
- Created user_attributes.html for managing user attributes from Keycloak
- Created attribute_definitions.html for managing attribute schemas
- Added AttributeManagementController with REST APIs for CRUD operations
- Added UserAttributesViewController for serving UI pages
- Created AttributeAssignmentDTO and SyncStatusDTO for data transfer
- Enhanced AttributeManagementService with methods for CRUD and sync
- Updated KeycloakAttributeSyncScheduler with sync status tracking
- Added repository methods for attribute queries
- Updated sidebar with links to User Attributes and Attribute Definitions pages
- All ABAC modules compile successfully
Co-authored-by: phrocker <[email protected]>
* Fix issues with build
* Fix KeycloakAttributeSyncScheduler dependency injection issue
- Made KeycloakAttributeSyncScheduler optional in AttributeManagementController
- Removed @requiredargsconstructor and added manual constructor
- Added @Autowired(required = false) for optional dependency injection
- Added null checks in sync endpoints to handle when scheduler is disabled
- Sync endpoints now return appropriate messages when sync is disabled
- Build successful with all modules compiling correctly
Co-authored-by: phrocker <[email protected]>
* Update
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: phrocker <[email protected]>
Co-authored-by: Marc Parisi <[email protected]>1 parent 3c6d8bd commit 4e937a3
File tree
48 files changed
+7006
-18
lines changed- api/src/main
- java/io/sentrius/sso/controllers
- api
- abac
- view
- resources
- db/migration
- templates
- fragments
- sso
- core/src/main/java/io/sentrius/sso/core
- annotations
- dto
- abac
- capabilities
- dataplane/src
- main/java/io/sentrius/sso/core
- model
- abac
- customattributes
- security
- repository
- abac
- customattributes
- services
- abac
- customattributes
- test/java/io/sentrius/sso/core
- model/security
- services
- abac
- customattributes
- docs
- sentrius-chart-launcher
- sentrius-chart
- templates
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
48 files changed
+7006
-18
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
Lines changed: 244 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
0 commit comments