FraunhoferISST / DataspaceConnector

This is an IDS Connector reference implementation.
https://www.isst.fraunhofer.de/de/geschaeftsfelder/datenwirtschaft/technologien/Dataspace-Connector.html
Apache License 2.0
103 stars 80 forks source link

Contract request does not find contract because of invalid consumer #350

Closed gregors101 closed 3 years ago

gregors101 commented 3 years ago

A contract agreement request is requested from consumer. The provider method ContractUtils.removeContractsWithInvalidConsumer(contracts, issuer) removes all contracts because the issuer does not fit to the contract consumer. The method works correct, but the process seems to be incomplete.

I created provider data like in the documentation of the project. For the contract I used this data:

{ "consumer": "http://testconsumer", "provider": "http://testprovider", "title": "test contract 1", "start": "2021-04-19T10:20:30.937Z", "end": "2021-10-19T13:20:30.937Z" }

Then I requested a contract agreement from the consumer. While agreement processing, the provider clears all contracts because the contract consumer has the value http://testconsumer and the issuerConnector is https://w3id.org/idsa/autogen/baseConnector/7b934432-a85e-41c5-9f65-669219dde4ea

public static List removeContractsWithInvalidConsumer( final List contracts, final URI issuerConnector) { Utils.requireNonNull(contracts, ErrorMessages.LIST_NULL); Utils.requireNonNull(issuerConnector, ErrorMessages.URI_NULL);

    return contracts.parallelStream()
            .filter(x -> x.**getConsumer**().equals(issuerConnector) || x.**getConsumer**()
                    .toString()
                    .isBlank())
            .collect(Collectors.toList());
}

Connector Version: 5.1.2

What is going wrong, should I use another value for the consumer into the contract data? Why is the issuer connector compared with the consumer address? The issuerConnector value seems to be auto generated, is this a correct behaviour?

juliapampus commented 3 years ago

There are two options when creating a contract offer: Either you don't set a consumer, then any consumer connector can negotiate a contract agreement for a resource. Or you set a consumer, then this id will be compared to the one of the issuer connector, as you already observed. We implemented this as a basis for hiding contract offers for one specific company from other requesting companies. The connector id in the default config.json is auto generated, correct. As described here this should be replaced by the correct connector address. This will be then referenced in the ids message and, on the provider side, compared to the prepared consumer id (or not if this was left empty).

gregors101 commented 3 years ago

Hi Julia, thank you for your explanation. I now understand the functionality for this part of contract agreement negotiation.