This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #193 from International-Data-Spaces-Association/de…
…velopment Release v7.1.0
- Loading branch information
Showing
73 changed files
with
1,566 additions
and
129 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
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
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
76 changes: 76 additions & 0 deletions
76
...st/configmanager/connector/dataspaceconnector/util/DataspaceConnectorRouteConfigurer.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,76 @@ | ||
package de.fraunhofer.isst.configmanager.connector.dataspaceconnector.util; | ||
|
||
import de.fraunhofer.iais.eis.AppRoute; | ||
import de.fraunhofer.iais.eis.ConnectorEndpoint; | ||
import de.fraunhofer.iais.eis.GenericEndpoint; | ||
import lombok.AccessLevel; | ||
import lombok.Setter; | ||
import lombok.experimental.FieldDefaults; | ||
import org.apache.commons.codec.binary.Base64; | ||
import org.apache.velocity.VelocityContext; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.core.io.DefaultResourceLoader; | ||
import org.springframework.core.io.Resource; | ||
import org.springframework.core.io.ResourceLoader; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Utility class for configuring Camel routes for the Dataspace Connector. | ||
*/ | ||
@Component | ||
@FieldDefaults(level = AccessLevel.PRIVATE) | ||
public class DataspaceConnectorRouteConfigurer { | ||
|
||
/** | ||
* Username for the Dataspace Connector. | ||
*/ | ||
@Setter | ||
@Value("${dataspace.connector.api.username}") | ||
String dataSpaceConnectorApiUsername; | ||
|
||
/** | ||
* Password for the Dataspace Connector. | ||
*/ | ||
@Setter | ||
@Value("${dataspace.connector.api.password}") | ||
String dataSpaceConnectorApiPassword; | ||
|
||
/** | ||
* ResourceLoader for loading Camel route templates from the classpath. | ||
*/ | ||
final ResourceLoader RESOURCE_LOADER = new DefaultResourceLoader(); | ||
|
||
/** | ||
* Adds basic authentication information for the Dataspace Connector to the Velocity context | ||
* for creating a Camel XML route to be used with the Dataspace Connector. | ||
* | ||
* @param velocityContext the context containing the values to insert into the route template | ||
*/ | ||
public void addBasicAuthToContext(final VelocityContext velocityContext) { | ||
final var auth = dataSpaceConnectorApiUsername + ":" + dataSpaceConnectorApiPassword; | ||
final var encodedAuth = Base64.encodeBase64(auth.getBytes()); | ||
final var authHeader = "Basic " + new String(encodedAuth); | ||
velocityContext.put("connectorAuthHeader", authHeader); | ||
} | ||
|
||
/** | ||
* Chooses and returns the route template for the Dataspace Connector based on the app route. | ||
* | ||
* @param appRoute the app route | ||
* @return the route template | ||
*/ | ||
public Resource getRouteTemplate(final AppRoute appRoute) { | ||
final var routeStart = appRoute.getAppRouteStart(); | ||
|
||
Resource resource; | ||
if (routeStart.get(0) instanceof GenericEndpoint) { | ||
resource = RESOURCE_LOADER.getResource("classpath:camel-templates/dataspaceconnector/http_to_connector_template.vm"); | ||
} else if (routeStart.get(0) instanceof ConnectorEndpoint) { | ||
resource = RESOURCE_LOADER.getResource("classpath:camel-templates/dataspaceconnector/connector_to_http_template.vm"); | ||
} else { | ||
resource = null; | ||
} | ||
|
||
return resource; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...a/de/fraunhofer/isst/configmanager/connector/trustedconnector/TrustedConnectorClient.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,76 @@ | ||
package de.fraunhofer.isst.configmanager.connector.trustedconnector; | ||
|
||
import de.fraunhofer.iais.eis.BaseConnector; | ||
import de.fraunhofer.iais.eis.ConfigurationModel; | ||
import de.fraunhofer.iais.eis.ConfigurationModelBuilder; | ||
import de.fraunhofer.iais.eis.ConnectorDeployMode; | ||
import de.fraunhofer.iais.eis.ConnectorStatus; | ||
import de.fraunhofer.iais.eis.LogLevel; | ||
import de.fraunhofer.isst.configmanager.connector.clients.DefaultConnectorClient; | ||
import de.fraunhofer.isst.configmanager.data.util.QueryInput; | ||
import lombok.NoArgsConstructor; | ||
import okhttp3.Response; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.net.URI; | ||
|
||
@Service | ||
@NoArgsConstructor | ||
@ConditionalOnExpression("${dataspace.connector.enabled:false} == false") | ||
public class TrustedConnectorClient implements DefaultConnectorClient { | ||
|
||
@Override | ||
public boolean sendConfiguration(final String configurationModel) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void getConnectorStatus() { | ||
|
||
} | ||
|
||
@Override | ||
public ConfigurationModel getConfiguration() { | ||
return new ConfigurationModelBuilder() | ||
._configurationModelLogLevel_(LogLevel.NO_LOGGING) | ||
._connectorStatus_(ConnectorStatus.CONNECTOR_ONLINE) | ||
._connectorDeployMode_(ConnectorDeployMode.TEST_DEPLOYMENT) | ||
._keyStorePassword_("password") | ||
._keyStore_(URI.create("file://cert-stores/keystore.p12")) | ||
._trustStorePassword_("password") | ||
._trustStore_(URI.create("file://cert-stores/truststore.p12")) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public BaseConnector getBaseConnector(final String accessURL, final String resourceId) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getPolicyPattern(final String policy) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public BaseConnector getSelfDeclaration() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String requestContractAgreement(final String recipientId, | ||
final String requestedArtifactId, | ||
final String contractOffer) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Response requestData(final String recipientId, | ||
final String requestedArtifactId, | ||
final String contractId, | ||
final String key, | ||
final QueryInput queryInput) { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.