Skip to content

Add marketplace 2.0 api client#18

Merged
angelmp01 merged 24 commits into
developfrom
feature/real-marketplace-components-api-usage
May 5, 2026
Merged

Add marketplace 2.0 api client#18
angelmp01 merged 24 commits into
developfrom
feature/real-marketplace-components-api-usage

Conversation

@valituguran
Copy link
Copy Markdown

Add Marketplace 2.0 client with config.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL added 3 commits April 21, 2026 10:48
…sage

# Conflicts:
#	api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/controller/ComponentsResponseFactory.java
#	api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/controller/ProjectComponentsController.java
#	api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/facade/ComponentsFacade.java
#	api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/mapper/MarketplaceMapper.java
#	api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/controller/ProjectComponentsControllerTest.java
#	api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/facade/ComponentsFacadeTest.java
#	api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/util/TestObjectsBuilder.java
#	external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/model/ProjectComponent.java
#	external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/service/impl/MarketplaceServiceMockImpl.java
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

…ate components and added mandatory parameters to the marketplace 2.0 provision component call
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

angelmp01 and others added 3 commits April 29, 2026 15:20
#20)

… Marketplace API client with bearer token support

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

…ds from MarketplaceInstanceConfig and MarketplaceServiceImpl
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL added 2 commits April 29, 2026 21:33
…nts-api-usage' into feature/real-marketplace-components-api-usage
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@jorge-romero jorge-romero requested a review from Copilot April 30, 2026 13:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Marketplace 2.0 external-service client (OpenAPI-generated RestTemplate client + multi-instance configuration) and adds a shared core-security module for JWT utilities and OBO token exchange, while adapting the project-component v0 API layer to use the new Marketplace client types.

Changes:

  • Add Marketplace 2.0 client factory/config + service implementation using OpenAPI-generated clients.
  • Add core-security module with JwtUtils and OboTokenService, and switch api-project to use it.
  • Update project-component v0 facade/controller/mapper and tests to use Marketplace 2.0 models and new exception handling paths.

Reviewed changes

Copilot reviewed 49 out of 50 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
persistence/src/main/java/org/opendevstack/apiservice/persistence/repository/AuthorizationPolicyJpaRepository.java Treat “global” policies as clientId IS NULL or blank via custom JPQL query.
persistence/src/main/java/org/opendevstack/apiservice/persistence/dao/PolicyDaoImpl.java Switch to new repository method for “global” policy lookup.
external-service-marketplace/src/test/java/org/opendevstack/apiservice/externalservice/marketplace/service/MarketplaceServiceImplTest.java Unit tests for new MarketplaceServiceImpl behavior.
external-service-marketplace/src/test/java/org/opendevstack/apiservice/externalservice/marketplace/service/CatalogItemOperationsTest.java Tests for catalog item id utility.
external-service-marketplace/src/test/java/org/opendevstack/apiservice/externalservice/marketplace/client/MarketplaceApiClientFactoryTest.java Tests for instance resolution / factory behavior.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/service/impl/MarketplaceServiceMockImpl.java Removes old mock implementation.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/service/impl/MarketplaceServiceImpl.java Adds Marketplace 2.0 service implementation (OBO-authenticated calls, provision/delete/register, etc.).
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/service/MarketplaceService.java Updates MarketplaceService contract to Marketplace 2.0 models and multi-instance support.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/service/CatalogItemOperations.java Adds helper for catalog item id encoding/decoding/combining.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/model/CreateComponentParameter.java Removes legacy create-component parameter model.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/exception/MarketplaceException.java Adds checked exception type for marketplace integration.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/config/MarketplaceServiceConfig.java Adds configuration properties root for marketplace instances + default instance.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/config/MarketplaceInstanceConfig.java Defines per-instance properties (base URLs, timeouts, OBO scope, SSL trust, catalog item id).
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/client/MarketplaceApiClientFactory.java Adds factory to build configured RestTemplates/clients per instance.
external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/client/MarketplaceApiClient.java Adds wrapper around generated ApiClient + bearer auth setup.
external-service-marketplace/pom.xml Adds OpenAPI generator plugin, dependencies, and core-security dependency.
external-service-marketplace/openapi/openapi-component_provisioner-v1.0.0.yaml Adds provisioner OpenAPI spec for client generation.
external-service-marketplace/openapi/openapi-component_catalog-v1.0.0.yaml Adds catalog OpenAPI spec for client generation.
external-service-marketplace/.openapi-generator-ignore Adds generator ignore patterns.
core-security/src/test/java/org/opendevstack/apiservice/core/security/obo/OboTokenServiceTest.java Adds tests for OBO token exchange service.
core-security/src/test/java/org/opendevstack/apiservice/core/security/jwt/JwtUtilsTest.java Adds tests for JWT helper utilities.
core-security/src/main/java/org/opendevstack/apiservice/core/security/obo/OboTokenService.java Adds OBO token exchange implementation.
core-security/src/main/java/org/opendevstack/apiservice/core/security/obo/OboTokenResponse.java Adds DTO for token endpoint response mapping.
core-security/src/main/java/org/opendevstack/apiservice/core/security/obo/OboTokenProperties.java Adds configuration properties for token exchange (url/id/secret).
core-security/src/main/java/org/opendevstack/apiservice/core/security/obo/OboTokenException.java Adds runtime exception for OBO exchange failures.
core-security/src/main/java/org/opendevstack/apiservice/core/security/jwt/JwtUtils.java Adds shared JWT helper utilities used by other modules.
application.yaml Adds OBO config and marketplace instance config in application config.
api-project/src/main/java/org/opendevstack/apiservice/project/util/SecurityUtils.java Removes project-local SecurityUtils in favor of shared JwtUtils.
api-project/src/main/java/org/opendevstack/apiservice/project/controller/ProjectController.java Switches client-id extraction to shared JwtUtils.
api-project/pom.xml Adds dependency on core-security.
api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/util/TestObjectsBuilder.java Updates test object builders to Marketplace 2.0 models and adds CatalogItem builder.
api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/facade/ComponentsFacadeTest.java Updates facade tests for provision flow and marketplace 2.0 DTOs.
api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/controller/advice/ProjectComponentsExceptionHandlerTest.java Adds tests for new conflict mapping (already-exists).
api-project-component-v0/src/test/java/org/opendevstack/apiservice/project/controller/ProjectComponentsControllerTest.java Updates controller tests for new provision semantics and component-id type change.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/mapper/StatusMap.java Adds mapping from marketplace statuses to legacy v0 statuses.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/mapper/MarketplaceMapper.java Reworks mapping to use Marketplace 2.0 OpenAPI models and provision parameters.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/facade/ComponentsFacade.java Reworks facade to provision via marketplace 2.0 client and fetch catalog item metadata.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/exception/ComponentRetrievalException.java Adds retrieval exception wrapper.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/exception/ComponentNotFoundException.java Adds overload with cause.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/exception/ComponentCreationException.java Adds overload with cause.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/exception/ComponentBadRequestException.java Adds bad-request exception type.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/exception/ComponentAlreadyExistsException.java Adds already-exists exception type.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/exception/CatalogItemNotFoundException.java Adds catalog-item-not-found exception type.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/controller/advice/ProjectComponentsExceptionHandler.java Adds handlers for new exception types and retrieval failures.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/controller/ProjectComponentsController.java Switches create to “provision” and changes componentId type to string.
api-project-component-v0/src/main/java/org/opendevstack/apiservice/project/controller/ComponentsResponseFactory.java Adds response helpers for conflict and unprocessable entity.
api-project-component-v0/pom.xml Adds dependency on core-security.
api-project-component-v0/openapi/api-project-component-v0.yaml Removes UUID format constraint for componentId parameter.
Makefile Extends clean target to remove targets/generated models and local Maven cache.
.gitignore Ignores generated Marketplace OpenAPI sources directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +285 to +289
void testGetProjectComponent_NullInstanceName_UsesDefaultClient() throws MarketplaceException {
// Passing null explicitly as instanceName should resolve via getDefaultInstance -> getAuthenticatedClient
String projectKey = "PROJ";
String componentId = "test-component";
MarketplaceInstanceConfig instanceConfig = new MarketplaceInstanceConfig();
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test implies null instanceName should be accepted, but MarketplaceApiClientFactory#getClient(String) is defined to throw on null/blank. Either make MarketplaceServiceImpl resolve null/blank to the default instance, or update the test to align with the factory contract.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment on lines +191 to +197
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, trustAllCerttificates, new java.security.SecureRandom());

HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
// Intentionally disabling hostname verification for development environments
HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);

Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of configureTrustAllCertificates() mutates global HttpsURLConnection defaults (socket factory + hostname verifier). Even if guarded by config, this leaks outside Marketplace and can unintentionally disable TLS verification for other outbound calls. Rework this to use a per-RestTemplate SSLContext / request factory instead of JVM-global defaults.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment thread external-service-marketplace/pom.xml Outdated
Comment on lines +140 to +145
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a second jsr305 dependency declaration later in this POM with a different scope. Remove the duplicate and standardize on one scope to avoid classpath surprises.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment on lines +24 to +26
return new String(encodeId(
new String(decodeId(component.getCatalogItemId())) + new String(decodeId(component.getCatalogItemRef()))));
}
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildCatalogItemId converts decoded Base64 bytes to String without specifying a charset. Specify the charset explicitly when constructing strings from bytes to avoid platform-dependent behavior.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread Makefile Outdated
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

angelmp01 and others added 2 commits April 30, 2026 20:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

1 similar comment
@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@github-actions
Copy link
Copy Markdown

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

Copy link
Copy Markdown
Contributor

@jorge-romero jorge-romero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the comments, there are things that should affect some use cases.

Comment thread application.yaml Outdated
provisioner-actions-base-url: ${MARKETPLACE_PROVISIONER_ACTIONS_BASE_URL:}
obo-scope: ${MARKETPLACE_OBO_SCOPE:}
trust-all-certificates: ${MARKETPLACE_TRUST_ALL_CERTS:false}
catalog-item-id: ${MARKETPLACE_CATALOG_ITEM_ID:}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this last line should not be needed

log.warn("No Marketplace instances configured – reporting unhealthy");
return false;
}
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing is check, only if it is configured

* Creates a {@link MarketplaceApiClient} authenticated with an OBO token
* obtained from the current request's JWT.
*/
private MarketplaceApiClient getAuthenticatedClient(String instanceName) throws MarketplaceException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you need 2 methods, for OBO and CC
or in the factory.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

📊 Static Analysis Summary

🔍 Code Quality Checks

  • ✅ JaCoCo coverage report generated

📦 Download detailed reports from the workflow artifacts.

@angelmp01 angelmp01 merged commit 44befbb into develop May 5, 2026
4 checks passed
@jorge-romero jorge-romero deleted the feature/real-marketplace-components-api-usage branch May 19, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants