Skip to content

Verifiable Presentations Template Management#1091

Open
udeepa15 wants to merge 10 commits into
wso2:feature-oid4vpfrom
udeepa15:presentation-management
Open

Verifiable Presentations Template Management#1091
udeepa15 wants to merge 10 commits into
wso2:feature-oid4vpfrom
udeepa15:presentation-management

Conversation

@udeepa15

Copy link
Copy Markdown

Purpose

This PR introduces the VP (Verifiable Presentation) Template Management API for WSO2 Identity Server, enabling administrators to manage Presentation Definitions used in OpenID4VP-based authentication flows.

Goals

  • Expose a REST API (/api/server/v1/vp/template) for full lifecycle management of Presentation Definitions.
  • Allow tenant administrators to create, retrieve, list, update, and delete Presentation Definitions.
  • Follow the existing identity-api-server module structure (modelled after vc.template.management).

Approach

Two new Maven modules are introduced under components/org.wso2.carbon.identity.api.server.vp.template.management:

vp.template.management.common

  • VPDefinitionManagementConstants — error codes and messages.
  • VPDefinitionManagementServiceHolder — OSGi service holder for PresentationDefinitionService.

vp.template.management.v1

  • Generated API layer (src/gen/java): PresentationDefinitionsApi, service interface, model classes (PresentationDefinitionCreationModel, PresentationDefinitionUpdateModel, PresentationDefinitionResponse, PresentationDefinitionList, PresentationDefinitionListItem, RequestedCredentialModel), and PresentationDefinitionsApiServiceFactory — all generated from PresentationDefinitions.yaml.
  • Implementation layer (src/main/java):
    • PresentationDefinitionsApiServiceImpl — delegates to the core service.
    • ServerVPDefinitionManagementService — handles model mapping, error classification (404/409/400/500), and tenant resolution.
  • The root pom.xml of identity-api-server is updated to include the new module declaration and both vp.template.management.common and vp.template.management.v1 dependency management entries.

The API follows a standard REST pattern:

Method Path Description
GET /vp/template List all Presentation Definitions
POST /vp/template Create a Presentation Definition
GET /vp/template/{definitionId} Get a Presentation Definition
PUT /vp/template/{definitionId} Update a Presentation Definition
DELETE /vp/template/{definitionId} Delete a Presentation Definition

User stories

  • As a tenant administrator, I want to define which credentials are required during a VP-based login flow, so that the OpenID4VP authenticator can present the correct Presentation Definition to the wallet.
  • As a tenant administrator, I want to manage (create, update, delete) multiple Presentation Definitions for different use cases (e.g., age verification, identity proofing).

Developer Checklist (Mandatory)

  • Complete the Developer Checklist in the related product-is issue to track any behavioral change or migration impact.

Release note

Introduces a new REST API (/api/server/v1/vp/template) for managing OpenID4VP Presentation Definitions in WSO2 Identity Server. Administrators can now create, retrieve, update, and delete Presentation Definitions used in VP-based authentication flows.

Test environment

  • JDK: 21
  • OS: macOS
  • Database: H2 (dev)
  • WSO2 IS: 7.x (identity-api-server 1.5.10-SNAPSHOT)

Summary by CodeRabbit

  • New Features
    • Adds VP (Verifiable Presentation) Template Management API with full CRUD endpoints (list, create, retrieve, update, delete), proper HTTP statuses, and Location header on creation.
    • Publishes OpenAPI 3 specification describing endpoints, request/response schemas, security, and error responses.
    • Introduces consistent API path constant and standardized error codes/messages for client and server errors.
  • Chores
    • Adds new modules to package the VP Template Management API and shared utilities.

@coderabbitai

coderabbitai Bot commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59298337-0d15-4d19-86dd-81d8cee57c94

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +38 to +43
public static PresentationDefinitionService getPresentationDefinitionService() {

return (PresentationDefinitionService) PrivilegedCarbonContext
.getThreadLocalCarbonContext()
.getOSGiService(PresentationDefinitionService.class, null);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 1

Suggested change
public static PresentationDefinitionService getPresentationDefinitionService() {
return (PresentationDefinitionService) PrivilegedCarbonContext
.getThreadLocalCarbonContext()
.getOSGiService(PresentationDefinitionService.class, null);
}
public static PresentationDefinitionService getPresentationDefinitionService() {
PresentationDefinitionService service = (PresentationDefinitionService) PrivilegedCarbonContext
.getThreadLocalCarbonContext()
.getOSGiService(PresentationDefinitionService.class, null);
if (service == null) {
log.error("PresentationDefinitionService OSGi service not found.");
}
return service;

Comment on lines +52 to +56
* @return PresentationDefinitionList
*/
public PresentationDefinitionList listPresentationDefinitions() {

try {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 2

Suggested change
* @return PresentationDefinitionList
*/
public PresentationDefinitionList listPresentationDefinitions() {
try {
public PresentationDefinitionList listPresentationDefinitions() {
try {
int tenantId = getTenantId();
log.info("Listing presentation definitions for tenant: " + tenantId);

Comment on lines +94 to +95
.tenantId(tenantId)
.build();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 3

Suggested change
.tenantId(tenantId)
.build();
PresentationDefinition created = service.createPresentationDefinition(definition, tenantId);
log.info("Successfully created presentation definition with ID: " + created.getDefinitionId());
return toResponse(created);

Comment on lines +45 to +55

@Override
public Response createPresentationDefinition(
PresentationDefinitionCreationModel presentationDefinitionCreationModel) {

PresentationDefinitionResponse created =
CORE_SERVICE.createPresentationDefinition(presentationDefinitionCreationModel);
URI location = URI.create(
VPDefinitionManagementConstants.VP_DEFINITION_MANAGEMENT_PATH_COMPONENT
+ "/" + created.getId());
return Response.created(location).entity(created).build();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 4

Suggested change
@Override
public Response createPresentationDefinition(
PresentationDefinitionCreationModel presentationDefinitionCreationModel) {
PresentationDefinitionResponse created =
CORE_SERVICE.createPresentationDefinition(presentationDefinitionCreationModel);
URI location = URI.create(
VPDefinitionManagementConstants.VP_DEFINITION_MANAGEMENT_PATH_COMPONENT
+ "/" + created.getId());
return Response.created(location).entity(created).build();
@Override
public Response createPresentationDefinition(
PresentationDefinitionCreationModel presentationDefinitionCreationModel) {
log.info("Creating new presentation definition");
PresentationDefinitionResponse created =
CORE_SERVICE.createPresentationDefinition(presentationDefinitionCreationModel);
URI location = URI.create(
VPDefinitionManagementConstants.VP_DEFINITION_MANAGEMENT_PATH_COMPONENT
+ "/" + created.getId());
log.debug("Successfully created presentation definition with ID: " + created.getId());
return Response.created(location).entity(created).build();
}

Comment on lines +72 to +77

@Override
public Response deletePresentationDefinition(String definitionId) {

CORE_SERVICE.deletePresentationDefinition(definitionId);
return Response.noContent().build();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 5

Suggested change
@Override
public Response deletePresentationDefinition(String definitionId) {
CORE_SERVICE.deletePresentationDefinition(definitionId);
return Response.noContent().build();
@Override
public Response deletePresentationDefinition(String definitionId) {
log.info("Deleting presentation definition with ID: " + definitionId);
CORE_SERVICE.deletePresentationDefinition(definitionId);
log.debug("Successfully deleted presentation definition with ID: " + definitionId);
return Response.noContent().build();
}

@wso2-engineering wso2-engineering Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI Agent Log Improvement Checklist

⚠️ Warning: AI-Generated Review Comments

  • The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
  • Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.

✅ Before merging this pull request:

  • Review all AI-generated comments for accuracy and relevance.
  • Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
Comment Accepted (Y/N) Reason
#### Log Improvement Suggestion No: 1
#### Log Improvement Suggestion No: 2
#### Log Improvement Suggestion No: 3
#### Log Improvement Suggestion No: 4
#### Log Improvement Suggestion No: 5

Introduce a new Presentation Definition Management API module for Verifiable Presentations (VP). Adds two submodules: a common module (pom, service holder, constants) and a v1 API module (pom, JAX-RS resource, generated models, service interface/factory, core service implementation, API impl and OpenAPI YAML). The core service integrates with PresentationDefinitionService via PrivilegedCarbonContext, handles CRUD operations, model conversions, and maps VP exceptions to REST errors. Also updates the root pom.xml to include the new components.
Rename and move the vc.presentation.definition component to vp.template.management to reflect VP template management naming. Updated module and artifactIds, bumped API module version from 1.5.9-SNAPSHOT to 1.5.10-SNAPSHOT, and adjusted root pom module list and dependency references. Java packages, generated API classes, factories, service holder, and core/impl classes were renamed to org.wso2.carbon.identity.api.server.vp.template.management.*. The JAX-RS path and OpenAPI YAML were updated from /presentation-definitions to /vp/template.
Replace the generic 'definition' payload with a typed requested_credentials list: add RequestedCredentialModel, update PresentationDefinitionCreationModel and PresentationDefinitionUpdateModel to use requested_credentials, and update OpenAPI schema (PresentationDefinitions.yaml). ServerVPDefinitionManagementService now builds presentation definition JSON and input descriptors from requested_credentials (generates a UUID definitionId and uses PresentationDefinitionUtil) and removes the old serializeDefinition helper. This enables constructing presentation definitions from structured credential requests.
Replace JSON-based presentation definition handling with strongly-typed RequestedCredential lists. Removed ObjectMapper and PresentationDefinitionUtil usage; create/update now populate PresentationDefinition.requestedCredentials via new toRequestedCredentials converter, and responses map requestedCredentials back to API models via toCredentialModels. Also removed special-case VPException invalid-message handling. This simplifies model conversion and avoids constructing raw definition JSON in the API layer.
Update pom.xml to consolidate two dependencies into the VP template management API artifact. Removed org.wso2.carbon.identity.server.api:common and org.wso2.carbon.identity.server.api:v1 entries and replaced them with org.wso2.carbon.identity.api.server.vp.template.management.v1, setting its scope to provided to avoid bundling at runtime.
Rename model properties and JSON/OpenAPI fields from requested_credentials -> credentials and requested_claims -> claims. Updated generated models (PresentationDefinitionCreationModel, PresentationDefinitionUpdateModel, RequestedCredentialModel), service mapping code (ServerVPDefinitionManagementService) and the PresentationDefinitions.yaml spec. Adjusted getters/setters and internal conversions to use the new names. Note: this changes the public API JSON keys, so clients must be updated to the new field names.
Replace the generic `definition` field in PresentationDefinitionResponse with a typed `credentials` list of RequestedCredentialModel, updating getters/setters and the JSON property name. Update ServerVPDefinitionManagementService to populate `credentials` instead of `definition`. Also update PresentationDefinitions.yaml to require `credentials` and define it as an array of RequestedCredentialModel. This makes the API response and OpenAPI schema explicitly model the requested credentials instead of using an untyped object.
Replace references to the old openid4vc presentation module with the renamed presentation.management module. Updated pom.xml in the common and v1 modules to depend on org.wso2.carbon.identity.openid4vc:org.wso2.carbon.identity.openid4vc.presentation.management (provided scope). Updated Java imports in VPDefinitionManagementServiceHolder and ServerVPDefinitionManagementService to use org.wso2.carbon.identity.openid4vc.presentation.management.service.PresentationDefinitionService to match the new package/artifact name.
Update imports and dependency to use the org.wso2.carbon.identity.openid4vc.presentation.management module instead of presentation.common/presentation.definition. Adjusted imports in ServerVPDefinitionManagementService (PresentationDefinitionNotFoundException, PresentationDefinition, RequestedCredential) and updated the pom.xml artifactId to org.wso2.carbon.identity.openid4vc.presentation.management to match the renamed/relocated module.
@udeepa15
udeepa15 force-pushed the presentation-management branch from c907649 to a9a7b36 Compare March 13, 2026 04:41
Bump copyright headers from 2025 to 2026 across the vp.template.management module. Updated poms and generated/source Java files (common, v1, and module root) to reflect the new copyright year.
@udeepa15
udeepa15 force-pushed the presentation-management branch from 848bbe4 to 99ae076 Compare March 23, 2026 09:07
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.

1 participant