This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #65 from catenax-ng/main
Feat: Implement EDC with Generic Endpoint
- Loading branch information
Showing
44 changed files
with
2,161 additions
and
512 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
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
72 changes: 72 additions & 0 deletions
72
src/main/java/org/eclipse/tractusx/valueaddedservice/config/GateWebClientConfiguration.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,72 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2023 BMW Group AG | ||
* Copyright (c) 2022,2023 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.valueaddedservice.config; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager; | ||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider; | ||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder; | ||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService; | ||
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; | ||
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
|
||
@Configuration | ||
public class GateWebClientConfiguration { | ||
|
||
@Value("${security.enabled}") | ||
private boolean isSecurityEnabled; | ||
|
||
@Value("${vas.gateClient.name}") | ||
private String clientName; | ||
|
||
@Bean | ||
@Qualifier("gateWebClient") | ||
@ConditionalOnProperty(prefix = "security", name = "enabled", havingValue = "true") | ||
public WebClient gateWebClient(ClientRegistrationRepository clientRegistrationRepository, OAuth2AuthorizedClientService authorizedClientService) { | ||
OAuth2AuthorizedClientProvider authorizedClientProvider = OAuth2AuthorizedClientProviderBuilder.builder().clientCredentials().build(); | ||
AuthorizedClientServiceOAuth2AuthorizedClientManager authorizedClientManager = new AuthorizedClientServiceOAuth2AuthorizedClientManager(clientRegistrationRepository, authorizedClientService); | ||
authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider); | ||
|
||
ServletOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager); | ||
oauth.setDefaultClientRegistrationId(clientName); | ||
return WebClient.builder() | ||
.apply(oauth.oauth2Configuration()) | ||
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) | ||
.build(); | ||
} | ||
|
||
@Bean | ||
@Qualifier("gateWebClient") | ||
@ConditionalOnProperty(prefix = "security", name = "enabled", havingValue = "false") | ||
public WebClient gateWebClientNoAuth() { | ||
return WebClient.builder().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
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
27 changes: 27 additions & 0 deletions
27
src/main/java/org/eclipse/tractusx/valueaddedservice/domain/enumeration/AddressType.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,27 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2023 BMW Group AG | ||
* Copyright (c) 2022,2023 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.valueaddedservice.domain.enumeration; | ||
|
||
public enum AddressType { | ||
LegalAndSiteMainAddress, | ||
LegalAddress, | ||
SiteMainAddress, | ||
AdditionalAddress | ||
} |
25 changes: 25 additions & 0 deletions
25
...n/java/org/eclipse/tractusx/valueaddedservice/domain/enumeration/BusinessPartnerRole.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,25 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2023 BMW Group AG | ||
* Copyright (c) 2022,2023 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.valueaddedservice.domain.enumeration; | ||
|
||
public enum BusinessPartnerRole { | ||
SUPPLIER, | ||
CUSTOMER | ||
} |
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
45 changes: 45 additions & 0 deletions
45
...ain/java/org/eclipse/tractusx/valueaddedservice/dto/bpdm/AlternativePostalAddressDto.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,45 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2023 BMW Group AG | ||
* Copyright (c) 2022,2023 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.valueaddedservice.dto.bpdm; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import lombok.*; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.deserializers.AlternativePostalAddressDtoDeserializer; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.gate.GateGeoCoordinateDto; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.pool.PoolAdministrativeAreaLevel; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@JsonDeserialize(using = AlternativePostalAddressDtoDeserializer.class) | ||
public class AlternativePostalAddressDto { | ||
private GateGeoCoordinateDto geographicCoordinates; | ||
private String country; | ||
private PoolAdministrativeAreaLevel administrativeAreaLevel1; | ||
private String simpleAdministrativeAreaLevel1; | ||
private PoolAdministrativeAreaLevel administrativeAreaLevel2; | ||
private String simpleAdministrativeAreaLevel2; | ||
private PoolAdministrativeAreaLevel administrativeAreaLevel3; | ||
private String simpleAdministrativeAreaLevel3; | ||
private String postalCode; | ||
private String city; | ||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/org/eclipse/tractusx/valueaddedservice/dto/bpdm/PhysicalPostalAddressDto.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,58 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2023 BMW Group AG | ||
* Copyright (c) 2022,2023 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.valueaddedservice.dto.bpdm; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.deserializers.PhysicalPostalAddressDtoDeserializer; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.gate.GateGeoCoordinateDto; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.gate.GateStreetDto; | ||
import org.eclipse.tractusx.valueaddedservice.dto.bpdm.pool.PoolAdministrativeAreaLevel; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
|
||
@JsonDeserialize(using = PhysicalPostalAddressDtoDeserializer.class) | ||
public class PhysicalPostalAddressDto { | ||
private GateGeoCoordinateDto geographicCoordinates; | ||
private String country; | ||
|
||
private PoolAdministrativeAreaLevel administrativeAreaLevel1; | ||
private String simpleAdministrativeAreaLevel1; | ||
|
||
private PoolAdministrativeAreaLevel administrativeAreaLevel2; | ||
private String simpleAdministrativeAreaLevel2; | ||
|
||
private PoolAdministrativeAreaLevel administrativeAreaLevel3; | ||
private String simpleAdministrativeAreaLevel3; | ||
|
||
private String postalCode; | ||
private String city; | ||
private String district; | ||
private GateStreetDto street; | ||
private String companyPostalCode; | ||
private String industrialZone; | ||
private String building; | ||
private String floor; | ||
private String door; | ||
} |
Oops, something went wrong.