Skip to content

Commit

Permalink
Extend DTR APIs for Access management
Browse files Browse the repository at this point in the history
- Adds new module to provide service contract for access control rules
  • Loading branch information
istvan-nagy-epam committed Jan 23, 2024
1 parent a09e77c commit 9ec467c
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 3 deletions.
77 changes: 77 additions & 0 deletions access-control-service-interface/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
~ Copyright (c) 2024 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License, Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>digital-twin-registry</artifactId>
<version>DEV-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>org.eclipse.tractusx.digital_twin_registry</groupId>
<artifactId>digital-twin-registry-access-control-service-interface</artifactId>
<name>Tractus-X Semantic Layer Digital Twin Registry Access Control Interface</name>
<description>Module contains the Semantic Layer Digital Twin Registry Service's access control service interface</description>
<packaging>jar</packaging>

<organization>
<name>${organization}</name>
<url>${url}</url>
</organization>

<licenses>
<license>
<name>${licence_name}</name>
<url>${licence_url}</url>
<distribution>${licence_distribution}</distribution>
<comments>${licence_comments}</comments>
</license>
</licenses>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.tractusx.semantics.accesscontrol.api;

import org.eclipse.tractusx.semantics.accesscontrol.api.exception.DenyAccessException;
import org.eclipse.tractusx.semantics.accesscontrol.api.model.AccessRule;
import org.eclipse.tractusx.semantics.accesscontrol.api.model.ShellVisibilityCriteria;
import org.eclipse.tractusx.semantics.accesscontrol.api.model.SpecificAssetId;

import java.util.Set;

public interface AccessControlRuleService {

Set<SpecificAssetId> filterValidSpecificAssetIdsForLookup(Set<SpecificAssetId> specificAssetIds, String bpn) throws DenyAccessException;

ShellVisibilityCriteria fetchVisibilityCriteriaForShell(Set<SpecificAssetId> specificAssetIds, String bpn) throws DenyAccessException;

Set<AccessRule> fetchApplicableRulesForPartner(String bpn) throws DenyAccessException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.tractusx.semantics.accesscontrol.api.exception;

public class DenyAccessException extends Exception {

public DenyAccessException(String message) {
super(message);
}

public DenyAccessException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.tractusx.semantics.accesscontrol.api.model;

import java.util.Set;

public record AccessRule(Set<SpecificAssetId> requiredSpecificAssetIds, Set<String> visibleSemanticIds) {


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.tractusx.semantics.accesscontrol.api.model;

import java.util.Set;

public record ShellVisibilityCriteria(Set<String> visibleSpecificAssetIdNames, Set<String> visibleSemanticIds) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.tractusx.semantics.accesscontrol.api.model;

public record SpecificAssetId(String name, String value) {
}
Empty file.
Empty file.
7 changes: 6 additions & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
Copyright (c) 2021-2023 T-Systems International GmbH
Copyright (c) 2021-2023 Contributors to the Eclipse Foundation
Copyright (c) 2021-2024 Contributors to the Eclipse Foundation
See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.
Expand Down Expand Up @@ -51,6 +52,10 @@
</licenses>

<dependencies>
<dependency>
<groupId>org.eclipse.tractusx.digital_twin_registry</groupId>
<artifactId>digital-twin-registry-access-control-service-interface</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
Expand Down
13 changes: 11 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
Copyright (c) 2021-2023 T-Systems International GmbH
Copyright (c) 2021-2023 Contributors to the Eclipse Foundation
Copyright (c) 2021-2024 Contributors to the Eclipse Foundation
See the AUTHORS file(s) distributed with this work for additional
information regarding authorship.
Expand Down Expand Up @@ -105,12 +106,20 @@

<modules>
<module>backend</module>
<!-- more modules are expected to come -->
<module>access-control-service-interface</module>
<!-- more modules are expected to come -->
</modules>

<dependencyManagement>
<dependencies>
<!-- Predefined potential dependencies and versions -->
<!-- Modules -->
<dependency>
<groupId>org.eclipse.tractusx.digital_twin_registry</groupId>
<artifactId>digital-twin-registry-access-control-service-interface</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Java Stuff -->
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down

0 comments on commit 9ec467c

Please sign in to comment.