Skip to content

Commit

Permalink
feat: show cx config in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtreier committed Oct 25, 2024
1 parent 528404a commit cbb0101
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 112 deletions.
50 changes: 29 additions & 21 deletions docs/api/sovity-edc-api-wrapper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,11 @@ components:
DataSourceType:
type: string
description: Supported Data Source Types by UiDataSource
default: CUSTOM
enum:
- HTTP_DATA
- ON_REQUEST
- CUSTOM
default: CUSTOM
SecretValue:
type: object
properties:
Expand Down Expand Up @@ -839,14 +839,14 @@ components:
UiDataSourceHttpDataMethod:
type: string
description: Supported HTTP Methods by UiDataSource
default: GET
enum:
- GET
- POST
- PUT
- PATCH
- DELETE
- OPTIONS
default: GET
UiDataSourceOnRequest:
required:
- contactEmail
Expand Down Expand Up @@ -1673,6 +1673,31 @@ components:
state:
$ref: "#/components/schemas/ContractNegotiationState"
description: Contract Negotiation Information
DashboardCxDidConfig:
required:
- bdrsUrl
- dimUrl
- myDid
- trustedVcIssuer
- walletTokenUrl
type: object
properties:
myDid:
type: string
description: My DID / edc.iam.issuer.id
walletTokenUrl:
type: string
description: Wallet Token Url / edc.iam.sts.oauth.token.url
trustedVcIssuer:
type: string
description: Trusted VC Issuer / edc.iam.trusted-issuer.cofinity.id
bdrsUrl:
type: string
description: BDRS Url / tx.iam.iatp.bdrs.server.url
dimUrl:
type: string
description: STS DIM Url / edc.iam.sts.dim.url
description: Managed Identity Wallet (MIW) Config
DashboardDapsConfig:
required:
- jwksUrl
Expand All @@ -1686,23 +1711,6 @@ components:
type: string
description: Your Connector's DAPS JWKS URL
description: DAPS Config
DashboardMiwConfig:
required:
- authorityId
- tokenUrl
- url
type: object
properties:
url:
type: string
description: Your Connector's MIW's URL
tokenUrl:
type: string
description: Your Connector's MIW's Token URL
authorityId:
type: string
description: Your Connector's MIW's Authority ID
description: Managed Identity Wallet (MIW) Config
DashboardPage:
required:
- connectorCuratorName
Expand Down Expand Up @@ -1772,8 +1780,8 @@ components:
description: Your Connector's Maintainer's Organization Name
connectorDapsConfig:
$ref: "#/components/schemas/DashboardDapsConfig"
connectorMiwConfig:
$ref: "#/components/schemas/DashboardMiwConfig"
connectorCxDidConfig:
$ref: "#/components/schemas/DashboardCxDidConfig"
description: Data as required by the UI's Dashboard Page
DashboardTransferAmounts:
required:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package de.sovity.edc.ext.wrapper.api.ui.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@NoArgsConstructor
@Schema(description = "Managed Identity Wallet (MIW) Config")
public class DashboardCxDidConfig {
@Schema(description = "My DID / edc.iam.issuer.id", requiredMode = Schema.RequiredMode.REQUIRED)
private String myDid;

@Schema(description = "Wallet Token Url / edc.iam.sts.oauth.token.url", requiredMode = Schema.RequiredMode.REQUIRED)
private String walletTokenUrl;

@Schema(description = "Trusted VC Issuer / edc.iam.trusted-issuer.cofinity.id", requiredMode = Schema.RequiredMode.REQUIRED)
private String trustedVcIssuer;

@Schema(description = "BDRS Url / tx.iam.iatp.bdrs.server.url", requiredMode = Schema.RequiredMode.REQUIRED)
private String bdrsUrl;

@Schema(description = "STS DIM Url / edc.iam.sts.dim.url", requiredMode = Schema.RequiredMode.REQUIRED)
private String dimUrl;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ public class DashboardPage {
@Schema(description = "Your Connector's DAPS Configuration (if present)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
private DashboardDapsConfig connectorDapsConfig;

@Schema(description = "Your Connector's MIW Configuration (if present)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
private DashboardMiwConfig connectorMiwConfig;
@Schema(description = "Your Connector's Catena-X Web-DID Configuration (if present)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
private DashboardCxDidConfig connectorCxDidConfig;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
import de.sovity.edc.ext.wrapper.api.ui.pages.contract_negotiations.ContractNegotiationStateService;
import de.sovity.edc.ext.wrapper.api.ui.pages.contract_negotiations.ContractOfferMapper;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.DashboardPageApiService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.CxDidConfigService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.DapsConfigService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.DashboardDataFetcher;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.MiwConfigService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.OwnConnectorEndpointServiceImpl;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.SelfDescriptionService;
import de.sovity.edc.ext.wrapper.api.ui.pages.data_offer.DataOfferPageApiService;
Expand Down Expand Up @@ -249,8 +249,8 @@ public static WrapperExtensionContext buildContext(
contractNegotiationBuilder,
contractNegotiationStateService
);
var miwConfigBuilder = new MiwConfigService(config);
var dapsConfigBuilder = new DapsConfigService(config);
var cxDidConfigService = new CxDidConfigService(config);
var dapsConfigService = new DapsConfigService(config);
var dashboardDataFetcher = new DashboardDataFetcher(
contractNegotiationStore,
transferProcessService,
Expand All @@ -261,8 +261,8 @@ public static WrapperExtensionContext buildContext(
var dashboardApiService = new DashboardPageApiService(
dashboardDataFetcher,
transferProcessStateService,
dapsConfigBuilder,
miwConfigBuilder,
dapsConfigService,
cxDidConfigService,
selfDescriptionService
);
var alwaysTruePolicyService = new AlwaysTruePolicyDefinitionService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import de.sovity.edc.ext.wrapper.api.ui.model.DashboardPage;
import de.sovity.edc.ext.wrapper.api.ui.model.DashboardTransferAmounts;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.CxDidConfigService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.DapsConfigService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.DashboardDataFetcher;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.MiwConfigService;
import de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services.SelfDescriptionService;
import de.sovity.edc.ext.wrapper.api.ui.pages.transferhistory.TransferProcessStateService;
import lombok.RequiredArgsConstructor;
Expand All @@ -41,7 +41,7 @@ public class DashboardPageApiService {
private final DashboardDataFetcher dashboardDataFetcher;
private final TransferProcessStateService transferProcessStateService;
private final DapsConfigService dapsConfigService;
private final MiwConfigService miwConfigService;
private final CxDidConfigService cxDidConfigService;
private final SelfDescriptionService selfDescriptionService;

@NotNull
Expand Down Expand Up @@ -83,7 +83,7 @@ public DashboardPage dashboardPage() {
dashboardPage.setConnectorMaintainerUrl(selfDescriptionService.getMaintainerUrl());
dashboardPage.setConnectorMaintainerName(selfDescriptionService.getMaintainerName());

dashboardPage.setConnectorMiwConfig(miwConfigService.buildMiwConfigOrNull());
dashboardPage.setConnectorCxDidConfig(cxDidConfigService.buildCxDidConfigOrNull());
dashboardPage.setConnectorDapsConfig(dapsConfigService.buildDapsConfigOrNull());
return dashboardPage;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2022 sovity GmbH
*
* 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
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* sovity GmbH - initial API and implementation
*
*/

package de.sovity.edc.ext.wrapper.api.ui.pages.dashboard.services;

import de.sovity.edc.ext.wrapper.api.ui.model.DashboardCxDidConfig;
import lombok.RequiredArgsConstructor;
import org.eclipse.edc.spi.system.configuration.Config;

import static com.apicatalog.jsonld.StringUtils.isBlank;

@RequiredArgsConstructor
public class CxDidConfigService {
private final Config config;

/**
* Wallet Token Url
*/
private static final String EDC_IAM_STS_OAUTH_TOKEN_URL = "edc.iam.sts.oauth.token.url";


/**
* Trusted VC Issuer
*/
private static final String EDC_IAM_TRUSTED_ISSUER_COFINITY_ID = "edc.iam.trusted-issuer.cofinity.id";


/**
* BDRS Url
*/

private static final String TX_IAM_IATP_BDRS_SERVER_URL = "tx.iam.iatp.bdrs.server.url";


/**
* My DID
*/
private static final String EDC_IAM_ISSUER_ID = "edc.iam.issuer.id";


/**
* DIM Url
*/
private static final String EDC_IAM_STS_DIM_URL = "edc.iam.sts.dim.url";

public DashboardCxDidConfig buildCxDidConfigOrNull() {
var cxDidConfig = new DashboardCxDidConfig();
cxDidConfig.setMyDid(configValue(EDC_IAM_ISSUER_ID));
cxDidConfig.setWalletTokenUrl(configValue(EDC_IAM_STS_OAUTH_TOKEN_URL));
cxDidConfig.setTrustedVcIssuer(configValue(EDC_IAM_TRUSTED_ISSUER_COFINITY_ID));
cxDidConfig.setDimUrl(configValue(EDC_IAM_STS_DIM_URL));
cxDidConfig.setBdrsUrl(configValue(TX_IAM_IATP_BDRS_SERVER_URL));
return isBlank(cxDidConfig.getMyDid()) ? null : cxDidConfig;
}

private String configValue(String configKey) {
return config.getString(configKey, "");
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ class DashboardPageApiServiceTest {
.configOverrides(config -> config
.property(CeConfigProps.EDC_OAUTH_TOKEN_URL, "https://token-url.daps")
.property(CeConfigProps.EDC_OAUTH_PROVIDER_JWKS_URL, "https://jwks-url.daps")
.property("tx.ssi.oauth.token.url", "https://token.miw")
.property("tx.ssi.miw.url", "https://miw")
.property("tx.ssi.miw.authority.id", "my-authority-id"))
.property("edc.iam.sts.oauth.token.url", "tokenUrl")
.property("edc.iam.trusted-issuer.cofinity.id", "myTrustedIssuer")
.property("edc.iam.issuer.id", "myDid")
.property("tx.iam.iatp.bdrs.server.url", "bdrsUrl")
.property("edc.iam.sts.dim.url", "dimUrl")
)
.beforeEdcStartup(runtime -> {
runtime.registerServiceMock(AssetIndex.class, assetIndex);
runtime.registerServiceMock(PolicyDefinitionService.class, policyDefinitionService);
Expand Down Expand Up @@ -143,10 +146,12 @@ void testConnectorMetadata(EdcClient client, Config config) {
assertThat(dashboardPage.getConnectorDapsConfig().getTokenUrl()).isEqualTo("https://token-url.daps");
assertThat(dashboardPage.getConnectorDapsConfig().getJwksUrl()).isEqualTo("https://jwks-url.daps");

assertThat(dashboardPage.getConnectorMiwConfig()).isNotNull();
assertThat(dashboardPage.getConnectorMiwConfig().getAuthorityId()).isEqualTo("my-authority-id");
assertThat(dashboardPage.getConnectorMiwConfig().getUrl()).isEqualTo("https://miw");
assertThat(dashboardPage.getConnectorMiwConfig().getTokenUrl()).isEqualTo("https://token.miw");
assertThat(dashboardPage.getConnectorCxDidConfig()).isNotNull();
assertThat(dashboardPage.getConnectorCxDidConfig().getMyDid()).isEqualTo("myDid");
assertThat(dashboardPage.getConnectorCxDidConfig().getWalletTokenUrl()).isEqualTo("tokenUrl");
assertThat(dashboardPage.getConnectorCxDidConfig().getTrustedVcIssuer()).isEqualTo("myTrustedIssuer");
assertThat(dashboardPage.getConnectorCxDidConfig().getBdrsUrl()).isEqualTo("bdrsUrl");
assertThat(dashboardPage.getConnectorCxDidConfig().getDimUrl()).isEqualTo("dimUrl");
}

private ContractNegotiation mockContractNegotiation(int contract, ContractNegotiation.Type type) {
Expand Down

0 comments on commit cbb0101

Please sign in to comment.