Skip to content

Implement RBAC-based authorization for Submodel Service#682

Merged
aaronzi merged 11 commits intoeclipse-basyx:mainfrom
geso02:sm-service-role-based-access
Apr 8, 2025
Merged

Implement RBAC-based authorization for Submodel Service#682
aaronzi merged 11 commits intoeclipse-basyx:mainfrom
geso02:sm-service-role-based-access

Conversation

@geso02
Copy link
Copy Markdown
Contributor

@geso02 geso02 commented Mar 26, 2025

🔐 Implement RBAC-based Authorization for Submodel Service
This pull request introduces rule-based authorization for the Submodel Service, addressing Issue #505.

✅ Summary
The implementation follows the general RBAC mechanism already used in the BaSyx stack and adapts it to the specifics of the Submodel Service. The logic is based on a configurable rbac_rule expression and leverages Spring Security to enforce access control.

⚙️ Key Considerations
Unlike the Submodel Repository, which allows broader update operations on submodels, the Submodel Service acts as a host for a single submodel. Therefore, this implementation focuses on fine-grained authorization on individual submodel elements, especially operations.

Treating submodel element invocations as part of a larger updateSubmodel() would have simplified the model, but at the cost of granularity. Preserving this granularity was seen as essential in the context of a dedicated submodel host.

This design decision is further discussed in Issue #674.

🔧 What's Included
basyx.submodelservice-feature-authorization: New feature module enabling RBAC-based access control

Integration of Spring Security into the Submodel Service runtime

Support for fine-grained access evaluation on submodel elements (e.g., invoking specific operations)

Configurable rbac_rule expressions for role-based access decisions

Integration test suite covering multiple authorization scenarios

Refactoring: Shared classes previously located in the Submodel Repository have been moved into the Submodel Service package structure, where they are more appropriately maintained and reused

🧪 Testing
A test script (run-security-test.sh) has been added to the example project. It demonstrates how to:

Obtain an access token from Keycloak (using client credentials flow)

Call operations that are permitted or denied, depending on the current token

geso02 added 3 commits March 26, 2025 10:01
This commit introduces support for rule-based (RBAC) authorization in the Submodel Service component, following the mechanism used in other parts of the BaSyx stack.

Key aspects:
- New module: basyx.submodelservice-feature-authorization
- Integration of Spring Security to evaluate access control using rbac_rule expressions
- Fine-grained access evaluation per submodel element (e.g., operations)
- Shared classes moved from Submodel Repository to Submodel Service for better reuse and separation
- Integration tests added to validate authorization behavior
- Example script (run-security-test.sh) included to demonstrate secured API usage with Keycloak

See also:
- Issue eclipse-basyx#505
- Design considerations in Issue eclipse-basyx#674
Copy link
Copy Markdown
Contributor Author

@geso02 geso02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update copyright year

@aaronzi aaronzi merged commit 1737a3f into eclipse-basyx:main Apr 8, 2025
28 checks passed
@geso02 geso02 deleted the sm-service-role-based-access branch May 6, 2025 06:00
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.

2 participants