Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements a feature to support the Submodel-based RBAC rules backend for the remaining components #574

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

mdanish98
Copy link
Contributor

Description of Changes

Implements a feature to support the Submodel-based RBAC rules backend. This also includes the management of RBAC rules dynamically using the Submodel API. It separates the backend into InMemory and Submodel-based.

Similar to the already implemented module #407

The remaining modules except the AAS Discovery are implemented in this PR.

BaSyx Configuration for Testing

These extra configurations are required along with the current authorization configurations to configure the newly implemented feature:

basyx.feature.authorization.rules.backend=Submodel
basyx.feature.authorization.rules.backend.submodel.authorization.endpoint=<Endpoint of the Security Submodel>
basyx.feature.authorization.rules.backend.submodel.authorization.token-endpoint=<Token Endpoint>
basyx.feature.authorization.rules.backend.submodel.authorization.grant-type = <CLIENT_CREDENTIALS> or <PASSWORD>
basyx.feature.authorization.rules.backend.submodel.authorization.client-id=<client-id>
basyx.feature.authorization.rules.backend.submodel.authorization.client-secret=<client-secret>
basyx.feature.authorization.rules.backend.submodel.authorization.username=<username>
basyx.feature.authorization.rules.backend.submodel.authorization.password=<password>

Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
@mdanish98 mdanish98 marked this pull request as ready for review January 8, 2025 10:15
@aaronzi aaronzi self-requested a review January 8, 2025 10:43
Copy link
Member

@aaronzi aaronzi left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. I added some remarks and questions.

@@ -0,0 +1,134 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

Comment on lines +59 to +84
public SubmodelElementCollection adapt(TargetInformation targetInformation) {

if (targetInformation instanceof AasTargetInformation)
return new AasTargetInformationAdapter().adapt(targetInformation);

if (targetInformation instanceof SubmodelTargetInformation)
return new SubmodelTargetInformationAdapter().adapt(targetInformation);

if (targetInformation instanceof ConceptDescriptionTargetInformation)
return new CDTargetInformationAdapter().adapt(targetInformation);

SubmodelElementCollection targetInformationSMC = new DefaultSubmodelElementCollection.Builder().idShort("targetInformation").build();

SubmodelElementList aasId = new DefaultSubmodelElementList.Builder().idShort("aasIds").build();
SubmodelElementList submodelId = new DefaultSubmodelElementList.Builder().idShort("submodelIds").build();
Property typeProperty = new DefaultProperty.Builder().idShort("@type").value("aas-environment").build();

List<SubmodelElement> aasIds = ((AasEnvironmentTargetInformation) targetInformation).getAasIds().stream().map(this::transform).collect(Collectors.toList());
List<SubmodelElement> submodelIds = ((AasEnvironmentTargetInformation) targetInformation).getSubmodelIds().stream().map(this::transform).collect(Collectors.toList());
aasId.setValue(aasIds);
submodelId.setValue(submodelIds);

targetInformationSMC.setValue(Arrays.asList(aasId, submodelId, typeProperty));

return targetInformationSMC;
}
Copy link
Member

Choose a reason for hiding this comment

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

You are handling ConceptDescriptionTargetInformation in L67-68 but in L72-73 you are only creating lists for aasIds and submodelIds. Are conceptDescriptionIds missing here?

@@ -0,0 +1,184 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

@@ -0,0 +1,114 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

SubmodelElementList aasId = new DefaultSubmodelElementList.Builder().idShort("conceptDescriptionIds").build();
Property typeProperty = new DefaultProperty.Builder().idShort("@type").value("concept-description").build();

List<SubmodelElement> aasIds = ((ConceptDescriptionTargetInformation) targetInformation)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
List<SubmodelElement> aasIds = ((ConceptDescriptionTargetInformation) targetInformation)
List<SubmodelElement> cdIds = ((ConceptDescriptionTargetInformation) targetInformation)

@@ -0,0 +1,161 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

@@ -0,0 +1,101 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

@@ -0,0 +1,155 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

@@ -0,0 +1,109 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

@@ -0,0 +1,173 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2024 the Eclipse BaSyx Authors
* Copyright (C) 2025 the Eclipse BaSyx Authors

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