-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #315 from bci-oss/feature/289-implement-new-dtr-va…
…lidation-api feat: Implement new DTR validation API (for submodel request)
- Loading branch information
Showing
16 changed files
with
773 additions
and
570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
...face/src/main/java/org/eclipse/tractusx/semantics/accesscontrol/api/model/AccessRule.java
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
.../src/test/java/org/eclipse/tractusx/semantics/accesscontrol/api/model/AccessRuleTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...se/tractusx/semantics/registry/controller/SubmodelDescriptorAuthorizationApiDelegate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH and others | ||
* | ||
* 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.registry.controller; | ||
|
||
import org.eclipse.tractusx.semantics.aas.registry.api.SubmodelDescriptorApiDelegate; | ||
import org.eclipse.tractusx.semantics.aas.registry.model.SubmodelEndpointAuthorization; | ||
import org.eclipse.tractusx.semantics.registry.service.ShellService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class SubmodelDescriptorAuthorizationApiDelegate implements SubmodelDescriptorApiDelegate { | ||
|
||
private final ShellService shellService; | ||
|
||
public SubmodelDescriptorAuthorizationApiDelegate( ShellService shellService ) { | ||
this.shellService = shellService; | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Void> postSubmodelDescriptorAuthorized( | ||
SubmodelEndpointAuthorization submodelEndpointAuthorization, String externalSubjectId ) { | ||
boolean visible = shellService.hasAccessToShellWithVisibleSubmodelEndpoint( submodelEndpointAuthorization.getSubmodelEndpointUrl(), externalSubjectId ); | ||
if ( visible ) { | ||
return ResponseEntity.ok().build(); | ||
} else { | ||
return ResponseEntity.status( HttpStatus.FORBIDDEN ).build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.