From fb3514d5a4f05945caecf367950da3407bae2cd4 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:57:20 +0530 Subject: [PATCH 01/10] Add VP presentation definition API module 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. --- .../pom.xml | 45 +++ .../VPDefinitionManagementConstants.java | 83 +++++ .../VPDefinitionManagementServiceHolder.java | 44 +++ .../pom.xml | 132 +++++++ .../vc/presentation/definition/v1/Error.java | 76 ++++ .../PresentationDefinitionCreationModel.java | 69 ++++ .../v1/PresentationDefinitionList.java | 57 +++ .../v1/PresentationDefinitionListItem.java | 65 ++++ .../v1/PresentationDefinitionResponse.java | 76 ++++ .../v1/PresentationDefinitionUpdateModel.java | 65 ++++ .../v1/PresentationDefinitionsApi.java | 141 ++++++++ .../v1/PresentationDefinitionsApiService.java | 39 +++ ...sentationDefinitionsApiServiceFactory.java | 35 ++ .../ServerVPDefinitionManagementService.java | 296 ++++++++++++++++ ...PresentationDefinitionsApiServiceImpl.java | 79 +++++ .../resources/PresentationDefinitions.yaml | 328 ++++++++++++++++++ .../pom.xml | 37 ++ pom.xml | 20 ++ 18 files changed, 1687 insertions(+) create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml create mode 100644 components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml new file mode 100644 index 0000000000..18a884503b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml @@ -0,0 +1,45 @@ + + + + + 4.0.0 + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.vc.presentation.definition + 1.5.9-SNAPSHOT + ../pom.xml + + + org.wso2.carbon.identity.api.server.vc.presentation.definition.common + jar + WSO2 Carbon - Presentation Definition Management API Common + + + + org.wso2.carbon + org.wso2.carbon.utils + + + org.wso2.carbon.identity.openid4vc + org.wso2.carbon.identity.openid4vc.presentation.definition + provided + + + diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java new file mode 100644 index 0000000000..1b2af9563e --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.common; + +/** + * Constants for Presentation Definition Management API. + */ +public class VPDefinitionManagementConstants { + + private VPDefinitionManagementConstants() { + } + + public static final String VP_DEFINITION_MANAGEMENT_PATH_COMPONENT = "/presentation-definitions"; + + /** + * Enum for error messages. + */ + public enum ErrorMessage { + + // Client errors (60xxx). + ERROR_CODE_DEFINITION_NOT_FOUND("VPD-60001", "Presentation definition not found.", + "Unable to find a presentation definition with the id: %s"), + ERROR_CODE_INVALID_INPUT("VPD-60002", "Invalid input.", + "Provided input is invalid. %s"), + ERROR_CODE_DEFINITION_ALREADY_EXISTS("VPD-60003", "Presentation definition already exists.", + "A presentation definition with the given identifier already exists."), + + // Server errors (65xxx). + ERROR_CODE_ERROR_LISTING_DEFINITIONS("VPD-65001", "Error listing presentation definitions.", + "A system error occurred while listing presentation definitions."), + ERROR_CODE_ERROR_CREATING_DEFINITION("VPD-65002", "Error creating presentation definition.", + "A system error occurred while creating the presentation definition."), + ERROR_CODE_ERROR_RETRIEVING_DEFINITION("VPD-65003", "Error retrieving presentation definition.", + "A system error occurred while retrieving the presentation definition with id: %s"), + ERROR_CODE_ERROR_UPDATING_DEFINITION("VPD-65004", "Error updating presentation definition.", + "A system error occurred while updating the presentation definition with id: %s"), + ERROR_CODE_ERROR_DELETING_DEFINITION("VPD-65005", "Error deleting presentation definition.", + "A system error occurred while deleting the presentation definition with id: %s"); + + private final String code; + private final String message; + private final String description; + + ErrorMessage(String code, String message, String description) { + this.code = code; + this.message = message; + this.description = description; + } + + public String getCode() { + return code; + } + + public String getMessage() { + return message; + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return code + " | " + message; + } + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java new file mode 100644 index 0000000000..282e997060 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.common; + +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; + +/** + * Service holder for VP Definition Management. + * Obtains the PresentationDefinitionService OSGi service via PrivilegedCarbonContext. + */ +public class VPDefinitionManagementServiceHolder { + + private VPDefinitionManagementServiceHolder() { + } + + /** + * Get PresentationDefinitionService OSGi service. + * + * @return PresentationDefinitionService instance + */ + public static PresentationDefinitionService getPresentationDefinitionService() { + + return (PresentationDefinitionService) PrivilegedCarbonContext + .getThreadLocalCarbonContext() + .getOSGiService(PresentationDefinitionService.class, null); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml new file mode 100644 index 0000000000..dae6a471a1 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml @@ -0,0 +1,132 @@ + + + + 4.0.0 + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.vc.presentation.definition + 1.5.9-SNAPSHOT + ../pom.xml + + + WSO2 Identity Server - VP Presentation Definition Management API + WSO2 IS - Presentation Definition Management API + org.wso2.carbon.identity.api.server.vc.presentation.definition.v1 + jar + + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + provided + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + javax.ws.rs + javax.ws.rs-api + provided + + + io.swagger + swagger-jaxrs + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + javax.ws.rs + jsr311-api + + + com.google.guava + guava + + + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.common + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.vc.presentation.definition.common + + + org.wso2.carbon.identity.openid4vc + org.wso2.carbon.identity.openid4vc.presentation.definition + provided + + + org.wso2.carbon.identity.openid4vc + org.wso2.carbon.identity.openid4vc.presentation.common + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + 1.8 + 1.8 + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java new file mode 100644 index 0000000000..887e38b080 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Error response model. + */ +@ApiModel(description = "Error response") +public class Error { + + private String code; + private String message; + private String description; + private String traceId; + + @ApiModelProperty(required = true, value = "Error code.") + @JsonProperty("code") + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + @ApiModelProperty(required = true, value = "Error message.") + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @ApiModelProperty(value = "Error description.") + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @ApiModelProperty(value = "Trace ID for debugging.") + @JsonProperty("traceId") + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java new file mode 100644 index 0000000000..e482301e65 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +/** + * Creation model for presentation definition. + */ +@ApiModel(description = "Creation model for presentation definition") +public class PresentationDefinitionCreationModel { + + @NotNull + private String name; + private String description; + @NotNull + private Object definition; + + @ApiModelProperty(required = true, value = "Name of the presentation definition.") + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty(value = "Description of the presentation definition.") + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @ApiModelProperty(required = true, value = "The full presentation definition JSON object.") + @JsonProperty("definition") + public Object getDefinition() { + return definition; + } + + public void setDefinition(Object definition) { + this.definition = definition; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java new file mode 100644 index 0000000000..947c2fb741 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; + +/** + * List response model for presentation definitions. + */ +@ApiModel(description = "List of presentation definitions") +public class PresentationDefinitionList { + + private Integer totalResults; + private List presentationDefinitions = new ArrayList<>(); + + @ApiModelProperty(value = "Total number of presentation definitions.") + @JsonProperty("totalResults") + public Integer getTotalResults() { + return totalResults; + } + + public void setTotalResults(Integer totalResults) { + this.totalResults = totalResults; + } + + @ApiModelProperty(value = "List of presentation definitions.") + @JsonProperty("presentationDefinitions") + public List getPresentationDefinitions() { + return presentationDefinitions; + } + + public void setPresentationDefinitions(List presentationDefinitions) { + this.presentationDefinitions = presentationDefinitions; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java new file mode 100644 index 0000000000..d5e214314a --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * List item model for presentation definitions. + */ +@ApiModel(description = "Presentation definition list item") +public class PresentationDefinitionListItem { + + private String id; + private String name; + private String description; + + @ApiModelProperty(value = "Unique identifier of the presentation definition.") + @JsonProperty("id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @ApiModelProperty(value = "Name of the presentation definition.") + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty(value = "Description of the presentation definition.") + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java new file mode 100644 index 0000000000..c2d2d5be2b --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Presentation definition response model. + */ +@ApiModel(description = "Presentation definition response") +public class PresentationDefinitionResponse { + + private String id; + private String name; + private String description; + private Object definition; + + @ApiModelProperty(value = "Unique identifier of the presentation definition.") + @JsonProperty("id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @ApiModelProperty(value = "Name of the presentation definition.") + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty(value = "Description of the presentation definition.") + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @ApiModelProperty(value = "The full presentation definition JSON object.") + @JsonProperty("definition") + public Object getDefinition() { + return definition; + } + + public void setDefinition(Object definition) { + this.definition = definition; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java new file mode 100644 index 0000000000..7e938b3e58 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Update model for presentation definition. + */ +@ApiModel(description = "Update model for presentation definition") +public class PresentationDefinitionUpdateModel { + + private String name; + private String description; + private Object definition; + + @ApiModelProperty(value = "Name of the presentation definition.") + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty(value = "Description of the presentation definition.") + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @ApiModelProperty(value = "The full presentation definition JSON object.") + @JsonProperty("definition") + public Object getDefinition() { + return definition; + } + + public void setDefinition(Object definition) { + this.definition = definition; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java new file mode 100644 index 0000000000..afba70446a --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.factories.PresentationDefinitionsApiServiceFactory; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +/** + * JAX-RS resource for Presentation Definition management. + */ +@Path("/presentation-definitions") +@Api(value = "/presentation-definitions", description = "Presentation Definition Management API") +public class PresentationDefinitionsApi { + + private final PresentationDefinitionsApiService delegate = + PresentationDefinitionsApiServiceFactory.getPresentationDefinitionsApi(); + + @GET + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "List Presentation Definitions", response = PresentationDefinitionList.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK", response = PresentationDefinitionList.class), + @ApiResponse(code = 401, message = "Unauthorized"), + @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response listPresentationDefinitions() { + + return delegate.listPresentationDefinitions(); + } + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Create a Presentation Definition", + response = PresentationDefinitionResponse.class) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created", response = PresentationDefinitionResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized"), + @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(code = 409, message = "Conflict", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response createPresentationDefinition( + @ApiParam(value = "Presentation definition to create", required = true) + PresentationDefinitionCreationModel presentationDefinitionCreationModel) { + + return delegate.createPresentationDefinition(presentationDefinitionCreationModel); + } + + @GET + @Path("/{definition-id}") + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Get a Presentation Definition", + response = PresentationDefinitionResponse.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK", response = PresentationDefinitionResponse.class), + @ApiResponse(code = 401, message = "Unauthorized"), + @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(code = 404, message = "Not Found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response getPresentationDefinition( + @ApiParam(value = "Unique identifier of the presentation definition.", required = true) + @PathParam("definition-id") String definitionId) { + + return delegate.getPresentationDefinition(definitionId); + } + + @PUT + @Path("/{definition-id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Update a Presentation Definition", + response = PresentationDefinitionResponse.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK", response = PresentationDefinitionResponse.class), + @ApiResponse(code = 400, message = "Bad Request", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized"), + @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(code = 404, message = "Not Found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response updatePresentationDefinition( + @ApiParam(value = "Unique identifier of the presentation definition.", required = true) + @PathParam("definition-id") String definitionId, + @ApiParam(value = "Updated presentation definition", required = true) + PresentationDefinitionUpdateModel presentationDefinitionUpdateModel) { + + return delegate.updatePresentationDefinition(definitionId, presentationDefinitionUpdateModel); + } + + @DELETE + @Path("/{definition-id}") + @ApiOperation(value = "Delete a Presentation Definition") + @ApiResponses(value = { + @ApiResponse(code = 204, message = "No Content"), + @ApiResponse(code = 401, message = "Unauthorized"), + @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(code = 404, message = "Not Found", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error", response = Error.class) + }) + public Response deletePresentationDefinition( + @ApiParam(value = "Unique identifier of the presentation definition.", required = true) + @PathParam("definition-id") String definitionId) { + + return delegate.deletePresentationDefinition(definitionId); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java new file mode 100644 index 0000000000..87633085de --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; + +import javax.ws.rs.core.Response; + +/** + * Service interface for Presentation Definitions API. + */ +public abstract class PresentationDefinitionsApiService { + + public abstract Response listPresentationDefinitions(); + + public abstract Response createPresentationDefinition( + PresentationDefinitionCreationModel presentationDefinitionCreationModel); + + public abstract Response getPresentationDefinition(String definitionId); + + public abstract Response updatePresentationDefinition(String definitionId, + PresentationDefinitionUpdateModel presentationDefinitionUpdateModel); + + public abstract Response deletePresentationDefinition(String definitionId); +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java new file mode 100644 index 0000000000..c15b292e1c --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.factories; + +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionsApiService; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.impl.PresentationDefinitionsApiServiceImpl; + +/** + * Factory class for PresentationDefinitionsApiService. + */ +public class PresentationDefinitionsApiServiceFactory { + + private static final PresentationDefinitionsApiService SERVICE = + new PresentationDefinitionsApiServiceImpl(); + + public static PresentationDefinitionsApiService getPresentationDefinitionsApi() { + return SERVICE; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java new file mode 100644 index 0000000000..5ba8ee146c --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.core; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.wso2.carbon.identity.api.server.common.ContextLoader; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.common.VPDefinitionManagementConstants.ErrorMessage; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.common.VPDefinitionManagementServiceHolder; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.Error; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionCreationModel; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionList; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionListItem; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionResponse; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionUpdateModel; +import org.wso2.carbon.identity.openid4vc.presentation.common.exception.PresentationDefinitionNotFoundException; +import org.wso2.carbon.identity.openid4vc.presentation.common.exception.VPException; +import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition; +import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; + +import java.util.List; +import java.util.stream.Collectors; +import javax.ws.rs.core.Response; + +/** + * Core service for VP Presentation Definition Management API. + * Handles business logic, model conversion, and error mapping. + */ +public class ServerVPDefinitionManagementService { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + /** + * List all presentation definitions for the current tenant. + * + * @return PresentationDefinitionList + */ + public PresentationDefinitionList listPresentationDefinitions() { + + try { + int tenantId = getTenantId(); + PresentationDefinitionService service = getService(); + + List definitions = service.getAllPresentationDefinitions(tenantId); + + PresentationDefinitionList listResponse = new PresentationDefinitionList(); + listResponse.setTotalResults(definitions.size()); + listResponse.setPresentationDefinitions( + definitions.stream() + .map(this::toListItem) + .collect(Collectors.toList())); + return listResponse; + } catch (VPException e) { + throw handleServerError(ErrorMessage.ERROR_CODE_ERROR_LISTING_DEFINITIONS, e); + } + } + + /** + * Create a new presentation definition. + * + * @param creationModel The creation model + * @return Created PresentationDefinitionResponse + */ + public PresentationDefinitionResponse createPresentationDefinition( + PresentationDefinitionCreationModel creationModel) { + + try { + int tenantId = getTenantId(); + PresentationDefinitionService service = getService(); + + String definitionJson = serializeDefinition(creationModel.getDefinition()); + + PresentationDefinition definition = new PresentationDefinition.Builder() + .name(creationModel.getName()) + .description(creationModel.getDescription()) + .definitionJson(definitionJson) + .tenantId(tenantId) + .build(); + + PresentationDefinition created = service.createPresentationDefinition(definition, tenantId); + return toResponse(created); + } catch (VPException e) { + if (e.getMessage() != null && e.getMessage().contains("already exists")) { + throw handleClientError(ErrorMessage.ERROR_CODE_DEFINITION_ALREADY_EXISTS, e, + Response.Status.CONFLICT); + } + if (e.getMessage() != null && (e.getMessage().contains("Invalid") || + e.getMessage().contains("required"))) { + throw handleClientError(ErrorMessage.ERROR_CODE_INVALID_INPUT, e, + Response.Status.BAD_REQUEST, e.getMessage()); + } + throw handleServerError(ErrorMessage.ERROR_CODE_ERROR_CREATING_DEFINITION, e); + } + } + + /** + * Get a presentation definition by ID. + * + * @param definitionId The definition ID + * @return PresentationDefinitionResponse + */ + public PresentationDefinitionResponse getPresentationDefinition(String definitionId) { + + try { + int tenantId = getTenantId(); + PresentationDefinitionService service = getService(); + + PresentationDefinition definition = service.getPresentationDefinitionById( + definitionId, tenantId); + return toResponse(definition); + } catch (PresentationDefinitionNotFoundException e) { + throw handleNotFound(definitionId); + } catch (VPException e) { + throw handleServerError(ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_DEFINITION, e, + definitionId); + } + } + + /** + * Update a presentation definition. + * + * @param definitionId The definition ID + * @param updateModel The update model + * @return Updated PresentationDefinitionResponse + */ + public PresentationDefinitionResponse updatePresentationDefinition( + String definitionId, PresentationDefinitionUpdateModel updateModel) { + + try { + int tenantId = getTenantId(); + PresentationDefinitionService service = getService(); + + String definitionJson = updateModel.getDefinition() != null + ? serializeDefinition(updateModel.getDefinition()) : null; + + PresentationDefinition definition = new PresentationDefinition.Builder() + .definitionId(definitionId) + .name(updateModel.getName()) + .description(updateModel.getDescription()) + .definitionJson(definitionJson) + .tenantId(tenantId) + .build(); + + PresentationDefinition updated = service.updatePresentationDefinition( + definition, tenantId); + return toResponse(updated); + } catch (PresentationDefinitionNotFoundException e) { + throw handleNotFound(definitionId); + } catch (VPException e) { + if (e.getMessage() != null && e.getMessage().contains("Invalid")) { + throw handleClientError(ErrorMessage.ERROR_CODE_INVALID_INPUT, e, + Response.Status.BAD_REQUEST, e.getMessage()); + } + throw handleServerError(ErrorMessage.ERROR_CODE_ERROR_UPDATING_DEFINITION, e, + definitionId); + } + } + + /** + * Delete a presentation definition. + * + * @param definitionId The definition ID + */ + public void deletePresentationDefinition(String definitionId) { + + try { + int tenantId = getTenantId(); + PresentationDefinitionService service = getService(); + + service.deletePresentationDefinition(definitionId, tenantId); + } catch (PresentationDefinitionNotFoundException e) { + throw handleNotFound(definitionId); + } catch (VPException e) { + throw handleServerError(ErrorMessage.ERROR_CODE_ERROR_DELETING_DEFINITION, e, + definitionId); + } + } + + // --- Conversion helpers --- + + private PresentationDefinitionResponse toResponse(PresentationDefinition definition) { + + PresentationDefinitionResponse response = new PresentationDefinitionResponse(); + response.setId(definition.getDefinitionId()); + response.setName(definition.getName()); + response.setDescription(definition.getDescription()); + + if (definition.getDefinitionJson() != null) { + try { + response.setDefinition( + OBJECT_MAPPER.readValue(definition.getDefinitionJson(), Object.class)); + } catch (Exception e) { + response.setDefinition(definition.getDefinitionJson()); + } + } + return response; + } + + private PresentationDefinitionListItem toListItem(PresentationDefinition definition) { + + PresentationDefinitionListItem item = new PresentationDefinitionListItem(); + item.setId(definition.getDefinitionId()); + item.setName(definition.getName()); + item.setDescription(definition.getDescription()); + return item; + } + + private String serializeDefinition(Object definition) { + + if (definition == null) { + return null; + } + try { + return OBJECT_MAPPER.writeValueAsString(definition); + } catch (Exception e) { + return definition.toString(); + } + } + + // --- Error handling --- + + private javax.ws.rs.WebApplicationException handleNotFound(String definitionId) { + + Error error = new Error(); + error.setCode(ErrorMessage.ERROR_CODE_DEFINITION_NOT_FOUND.getCode()); + error.setMessage(ErrorMessage.ERROR_CODE_DEFINITION_NOT_FOUND.getMessage()); + error.setDescription( + String.format(ErrorMessage.ERROR_CODE_DEFINITION_NOT_FOUND.getDescription(), + definitionId)); + return new javax.ws.rs.WebApplicationException( + Response.status(Response.Status.NOT_FOUND).entity(error).build()); + } + + private javax.ws.rs.WebApplicationException handleClientError( + ErrorMessage errorMessage, Exception e, Response.Status status, String... args) { + + Error error = new Error(); + error.setCode(errorMessage.getCode()); + error.setMessage(errorMessage.getMessage()); + error.setDescription(args.length > 0 + ? String.format(errorMessage.getDescription(), (Object[]) args) + : errorMessage.getDescription()); + return new javax.ws.rs.WebApplicationException( + Response.status(status).entity(error).build()); + } + + private javax.ws.rs.WebApplicationException handleServerError( + ErrorMessage errorMessage, Exception e, String... args) { + + Error error = new Error(); + error.setCode(errorMessage.getCode()); + error.setMessage(errorMessage.getMessage()); + error.setDescription(args.length > 0 + ? String.format(errorMessage.getDescription(), (Object[]) args) + : errorMessage.getDescription()); + return new javax.ws.rs.WebApplicationException( + Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); + } + + // --- Utility --- + + private int getTenantId() { + + return ContextLoader.getTenantDomainFromContext() != null + ? org.wso2.carbon.context.PrivilegedCarbonContext + .getThreadLocalCarbonContext().getTenantId() + : -1234; // Super-tenant default + } + + private PresentationDefinitionService getService() { + + PresentationDefinitionService service = + VPDefinitionManagementServiceHolder.getPresentationDefinitionService(); + if (service == null) { + throw new javax.ws.rs.WebApplicationException( + Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity("PresentationDefinitionService is not available").build()); + } + return service; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java new file mode 100644 index 0000000000..81044fb885 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.impl; + +import org.wso2.carbon.identity.api.server.vc.presentation.definition.common.VPDefinitionManagementConstants; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionCreationModel; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionResponse; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionUpdateModel; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionsApiService; +import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.core.ServerVPDefinitionManagementService; + +import java.net.URI; +import javax.ws.rs.core.Response; + +/** + * Implementation of PresentationDefinitionsApiService. + * Delegates all operations to ServerVPDefinitionManagementService and wraps in JAX-RS Response. + */ +public class PresentationDefinitionsApiServiceImpl extends PresentationDefinitionsApiService { + + private static final ServerVPDefinitionManagementService CORE_SERVICE = + new ServerVPDefinitionManagementService(); + + @Override + public Response listPresentationDefinitions() { + + return Response.ok().entity(CORE_SERVICE.listPresentationDefinitions()).build(); + } + + @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 getPresentationDefinition(String definitionId) { + + return Response.ok().entity(CORE_SERVICE.getPresentationDefinition(definitionId)).build(); + } + + @Override + public Response updatePresentationDefinition(String definitionId, + PresentationDefinitionUpdateModel presentationDefinitionUpdateModel) { + + return Response.ok().entity( + CORE_SERVICE.updatePresentationDefinition(definitionId, + presentationDefinitionUpdateModel)).build(); + } + + @Override + public Response deletePresentationDefinition(String definitionId) { + + CORE_SERVICE.deletePresentationDefinition(definitionId); + return Response.noContent().build(); + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml new file mode 100644 index 0000000000..a497637c7d --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml @@ -0,0 +1,328 @@ +openapi: 3.0.0 +info: + title: "WSO2 IS Presentation Definition Management API" + version: "v1" + description: "Admin API for managing presentation definitions in WSO2 Identity Server." + contact: + name: WSO2 + url: 'http://wso2.com/products/identity-server/' + email: architecture@wso2.org + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + +servers: + - url: 'https://{server-url}/t/{tenant-domain}/api/server/v1' + variables: + server-url: + default: localhost:9443 + tenant-domain: + default: carbon.super + +security: + - OAuth2: [] + - BasicAuth: [] + +paths: + /presentation-definitions: + get: + tags: + - Presentation Definitions + summary: List Presentation Definitions + description: | + Returns a list of all presentation definitions for the tenant. + operationId: listPresentationDefinitions + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PresentationDefinitionList' + '401': + description: Unauthorized + '403': + description: Forbidden + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + tags: + - Presentation Definitions + summary: Create a Presentation Definition + description: | + Creates a new presentation definition. + operationId: createPresentationDefinition + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PresentationDefinitionCreationModel' + required: true + responses: + '201': + description: Created + headers: + Location: + description: URI of the created resource. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/PresentationDefinitionResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '401': + description: Unauthorized + '403': + description: Forbidden + '409': + description: Conflict + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + /presentation-definitions/{definition-id}: + get: + tags: + - Presentation Definitions + summary: Get a Presentation Definition + description: | + Retrieves a presentation definition by its ID. + operationId: getPresentationDefinition + parameters: + - $ref: '#/components/parameters/definitionIdPathParam' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PresentationDefinitionResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + put: + tags: + - Presentation Definitions + summary: Update a Presentation Definition + description: | + Updates an existing presentation definition. + operationId: updatePresentationDefinition + parameters: + - $ref: '#/components/parameters/definitionIdPathParam' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PresentationDefinitionUpdateModel' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PresentationDefinitionResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + tags: + - Presentation Definitions + summary: Delete a Presentation Definition + description: | + Deletes a presentation definition by its ID. + operationId: deletePresentationDefinition + parameters: + - $ref: '#/components/parameters/definitionIdPathParam' + responses: + '204': + description: No Content + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + +components: + parameters: + definitionIdPathParam: + name: definition-id + in: path + description: Unique identifier of the presentation definition. + required: true + schema: + type: string + + schemas: + PresentationDefinitionResponse: + type: object + required: + - id + - name + - definition + properties: + id: + type: string + description: Unique identifier of the presentation definition. + example: "pd-001" + name: + type: string + description: Name of the presentation definition. + example: "Employee Credential Verification" + description: + type: string + description: Description of the presentation definition. + example: "Verifies employee credentials" + definition: + type: object + description: The full presentation definition JSON object. + + PresentationDefinitionCreationModel: + type: object + required: + - name + - definition + properties: + name: + type: string + description: Name of the presentation definition. + example: "Employee Credential Verification" + description: + type: string + description: Description of the presentation definition. + example: "Verifies employee credentials" + definition: + type: object + description: The full presentation definition JSON object. + + PresentationDefinitionUpdateModel: + type: object + properties: + name: + type: string + description: Name of the presentation definition. + example: "Updated Employee Credential Verification" + description: + type: string + description: Description of the presentation definition. + definition: + type: object + description: The full presentation definition JSON object. + + PresentationDefinitionList: + type: object + properties: + totalResults: + type: integer + description: Total number of presentation definitions. + example: 2 + presentationDefinitions: + type: array + items: + $ref: '#/components/schemas/PresentationDefinitionListItem' + + PresentationDefinitionListItem: + type: object + properties: + id: + type: string + description: Unique identifier of the presentation definition. + example: "pd-001" + name: + type: string + description: Name of the presentation definition. + example: "Employee Credential Verification" + description: + type: string + description: Description of the presentation definition. + + Error: + type: object + required: + - code + - message + properties: + code: + type: string + example: "VPD-60001" + message: + type: string + example: "Some error message" + description: + type: string + example: "Some error description" + traceId: + type: string + example: "e0fbcfeb-3617-43c4-8dd0-7b7d38e13047" + + securitySchemes: + BasicAuth: + type: http + scheme: basic + OAuth2: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: 'https://localhost:9443/oauth2/authorize' + tokenUrl: 'https://localhost:9443/oauth2/token' + scopes: {} diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml new file mode 100644 index 0000000000..06a679aac7 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml @@ -0,0 +1,37 @@ + + + + + 4.0.0 + + + org.wso2.carbon.identity.server.api + identity-api-server + 1.5.9-SNAPSHOT + ../../pom.xml + + + org.wso2.carbon.identity.api.server.vc.presentation.definition + pom + + + org.wso2.carbon.identity.api.server.vc.presentation.definition.v1 + org.wso2.carbon.identity.api.server.vc.presentation.definition.common + + diff --git a/pom.xml b/pom.xml index a52b007991..077198a604 100644 --- a/pom.xml +++ b/pom.xml @@ -907,6 +907,24 @@ ${project.version} provided + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.vc.presentation.definition.common + ${project.version} + provided + + + org.wso2.carbon.identity.openid4vc + org.wso2.carbon.identity.openid4vc.presentation.definition + ${carbon.identity.openid4vc.version} + provided + + + org.wso2.carbon.identity.openid4vc + org.wso2.carbon.identity.openid4vc.presentation.common + ${carbon.identity.openid4vc.version} + provided + org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.credential.management.common @@ -1104,6 +1122,7 @@ 1.1.5 + 6.9.10 5.14.2 @@ -1155,6 +1174,7 @@ components/org.wso2.carbon.identity.api.server.workflow components/org.wso2.carbon.identity.api.server.asynchronous.operation.status.management components/org.wso2.carbon.identity.api.server.vc.template.management + components/org.wso2.carbon.identity.api.server.vc.presentation.definition components/org.wso2.carbon.identity.api.server.credential.management From f7002cab44c6813bb50e043564f7480988ad5db9 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Wed, 25 Feb 2026 15:22:10 +0530 Subject: [PATCH 02/10] Rename presentation-def module to vp.template 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. --- .../pom.xml | 8 ++++---- .../VPDefinitionManagementConstants.java | 2 +- .../VPDefinitionManagementServiceHolder.java | 2 +- .../pom.xml | 12 ++++++------ .../vp/template/management}/v1/Error.java | 2 +- .../PresentationDefinitionCreationModel.java | 2 +- .../v1/PresentationDefinitionList.java | 2 +- .../v1/PresentationDefinitionListItem.java | 2 +- .../v1/PresentationDefinitionResponse.java | 2 +- .../v1/PresentationDefinitionUpdateModel.java | 2 +- .../v1/PresentationDefinitionsApi.java | 8 ++++---- .../v1/PresentationDefinitionsApiService.java | 2 +- ...esentationDefinitionsApiServiceFactory.java | 6 +++--- .../ServerVPDefinitionManagementService.java | 18 +++++++++--------- .../PresentationDefinitionsApiServiceImpl.java | 14 +++++++------- .../resources/PresentationDefinitions.yaml | 4 ++-- .../pom.xml | 8 ++++---- pom.xml | 4 ++-- 18 files changed, 50 insertions(+), 50 deletions(-) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common}/pom.xml (83%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management}/common/VPDefinitionManagementConstants.java (97%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management}/common/VPDefinitionManagementServiceHolder.java (94%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1 => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1}/pom.xml (90%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/Error.java (96%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionCreationModel.java (96%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionList.java (96%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionListItem.java (95%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionResponse.java (96%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionUpdateModel.java (96%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionsApi.java (94%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/PresentationDefinitionsApiService.java (94%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/factories/PresentationDefinitionsApiServiceFactory.java (76%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/core/ServerVPDefinitionManagementService.java (92%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management}/v1/impl/PresentationDefinitionsApiServiceImpl.java (79%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1 => org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1}/src/main/resources/PresentationDefinitions.yaml (99%) rename components/{org.wso2.carbon.identity.api.server.vc.presentation.definition => org.wso2.carbon.identity.api.server.vp.template.management}/pom.xml (79%) diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml similarity index 83% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml index 18a884503b..ed273f8655 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.api.server.vc.presentation.definition - 1.5.9-SNAPSHOT + org.wso2.carbon.identity.api.server.vp.template.management + 1.5.10-SNAPSHOT ../pom.xml - org.wso2.carbon.identity.api.server.vc.presentation.definition.common + org.wso2.carbon.identity.api.server.vp.template.management.common jar - WSO2 Carbon - Presentation Definition Management API Common + WSO2 Carbon - VP Template Management API Common diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementConstants.java similarity index 97% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementConstants.java index 1b2af9563e..bb14402800 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementConstants.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementConstants.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.common; +package org.wso2.carbon.identity.api.server.vp.template.management.common; /** * Constants for Presentation Definition Management API. diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java similarity index 94% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java index 282e997060..eef757035a 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.common/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/common/VPDefinitionManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.common; +package org.wso2.carbon.identity.api.server.vp.template.management.common; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml similarity index 90% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml index dae6a471a1..c7799f3b08 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.api.server.vc.presentation.definition - 1.5.9-SNAPSHOT + org.wso2.carbon.identity.api.server.vp.template.management + 1.5.10-SNAPSHOT ../pom.xml - WSO2 Identity Server - VP Presentation Definition Management API - WSO2 IS - Presentation Definition Management API - org.wso2.carbon.identity.api.server.vc.presentation.definition.v1 + WSO2 Identity Server - VP Template Management API + WSO2 IS - VP Template Management API + org.wso2.carbon.identity.api.server.vp.template.management.v1 jar @@ -83,7 +83,7 @@ org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.api.server.vc.presentation.definition.common + org.wso2.carbon.identity.api.server.vp.template.management.common org.wso2.carbon.identity.openid4vc diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/Error.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/Error.java index 887e38b080..c941360664 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/Error.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/Error.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java index e482301e65..55778bb814 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionCreationModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionList.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionList.java index 947c2fb741..a15a7feada 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionList.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionList.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionListItem.java similarity index 95% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionListItem.java index d5e214314a..c90a15794d 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionListItem.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionListItem.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java index c2d2d5be2b..194b0d343b 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionResponse.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java similarity index 96% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java index 7e938b3e58..2214567440 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionUpdateModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionsApi.java similarity index 94% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionsApi.java index afba70446a..19f73e96a3 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApi.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionsApi.java @@ -16,14 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.factories.PresentationDefinitionsApiServiceFactory; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.factories.PresentationDefinitionsApiServiceFactory; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -39,8 +39,8 @@ /** * JAX-RS resource for Presentation Definition management. */ -@Path("/presentation-definitions") -@Api(value = "/presentation-definitions", description = "Presentation Definition Management API") +@Path("/vp/template") +@Api(value = "/vp/template", description = "Presentation Definition Management API") public class PresentationDefinitionsApi { private final PresentationDefinitionsApiService delegate = diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionsApiService.java similarity index 94% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionsApiService.java index 87633085de..8ea6c20df3 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/PresentationDefinitionsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionsApiService.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1; +package org.wso2.carbon.identity.api.server.vp.template.management.v1; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/factories/PresentationDefinitionsApiServiceFactory.java similarity index 76% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/factories/PresentationDefinitionsApiServiceFactory.java index c15b292e1c..0d117d4d5d 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/gen/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/factories/PresentationDefinitionsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/factories/PresentationDefinitionsApiServiceFactory.java @@ -16,10 +16,10 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.factories; +package org.wso2.carbon.identity.api.server.vp.template.management.v1.factories; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionsApiService; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.impl.PresentationDefinitionsApiServiceImpl; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionsApiService; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.impl.PresentationDefinitionsApiServiceImpl; /** * Factory class for PresentationDefinitionsApiService. diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java similarity index 92% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index 5ba8ee146c..a810dc8624 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -16,18 +16,18 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.core; +package org.wso2.carbon.identity.api.server.vp.template.management.v1.core; import com.fasterxml.jackson.databind.ObjectMapper; import org.wso2.carbon.identity.api.server.common.ContextLoader; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.common.VPDefinitionManagementConstants.ErrorMessage; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.common.VPDefinitionManagementServiceHolder; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.Error; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionCreationModel; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionList; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionListItem; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionResponse; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionUpdateModel; +import org.wso2.carbon.identity.api.server.vp.template.management.common.VPDefinitionManagementConstants.ErrorMessage; +import org.wso2.carbon.identity.api.server.vp.template.management.common.VPDefinitionManagementServiceHolder; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.Error; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionCreationModel; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionList; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionListItem; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionResponse; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionUpdateModel; import org.wso2.carbon.identity.openid4vc.presentation.common.exception.PresentationDefinitionNotFoundException; import org.wso2.carbon.identity.openid4vc.presentation.common.exception.VPException; import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/impl/PresentationDefinitionsApiServiceImpl.java similarity index 79% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/impl/PresentationDefinitionsApiServiceImpl.java index 81044fb885..65654fc052 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/java/org/wso2/carbon/identity/api/server/vc/presentation/definition/v1/impl/PresentationDefinitionsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/impl/PresentationDefinitionsApiServiceImpl.java @@ -16,14 +16,14 @@ * under the License. */ -package org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.impl; +package org.wso2.carbon.identity.api.server.vp.template.management.v1.impl; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.common.VPDefinitionManagementConstants; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionCreationModel; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionResponse; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionUpdateModel; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.PresentationDefinitionsApiService; -import org.wso2.carbon.identity.api.server.vc.presentation.definition.v1.core.ServerVPDefinitionManagementService; +import org.wso2.carbon.identity.api.server.vp.template.management.common.VPDefinitionManagementConstants; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionCreationModel; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionResponse; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionUpdateModel; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionsApiService; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.core.ServerVPDefinitionManagementService; import java.net.URI; import javax.ws.rs.core.Response; diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml similarity index 99% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml rename to components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml index a497637c7d..c7ac3a6d5c 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/org.wso2.carbon.identity.api.server.vc.presentation.definition.v1/src/main/resources/PresentationDefinitions.yaml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml @@ -24,7 +24,7 @@ security: - BasicAuth: [] paths: - /presentation-definitions: + /vp/template: get: tags: - Presentation Definitions @@ -97,7 +97,7 @@ paths: schema: $ref: '#/components/schemas/Error' - /presentation-definitions/{definition-id}: + /vp/template/{definition-id}: get: tags: - Presentation Definitions diff --git a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml b/components/org.wso2.carbon.identity.api.server.vp.template.management/pom.xml similarity index 79% rename from components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml rename to components/org.wso2.carbon.identity.api.server.vp.template.management/pom.xml index 06a679aac7..7cec6152c0 100644 --- a/components/org.wso2.carbon.identity.api.server.vc.presentation.definition/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/pom.xml @@ -23,15 +23,15 @@ org.wso2.carbon.identity.server.api identity-api-server - 1.5.9-SNAPSHOT + 1.5.10-SNAPSHOT ../../pom.xml - org.wso2.carbon.identity.api.server.vc.presentation.definition + org.wso2.carbon.identity.api.server.vp.template.management pom - org.wso2.carbon.identity.api.server.vc.presentation.definition.v1 - org.wso2.carbon.identity.api.server.vc.presentation.definition.common + org.wso2.carbon.identity.api.server.vp.template.management.v1 + org.wso2.carbon.identity.api.server.vp.template.management.common diff --git a/pom.xml b/pom.xml index 077198a604..7b6c1b6ba3 100644 --- a/pom.xml +++ b/pom.xml @@ -909,7 +909,7 @@ org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.api.server.vc.presentation.definition.common + org.wso2.carbon.identity.api.server.vp.template.management.common ${project.version} provided @@ -1174,7 +1174,7 @@ components/org.wso2.carbon.identity.api.server.workflow components/org.wso2.carbon.identity.api.server.asynchronous.operation.status.management components/org.wso2.carbon.identity.api.server.vc.template.management - components/org.wso2.carbon.identity.api.server.vc.presentation.definition + components/org.wso2.carbon.identity.api.server.vp.template.management components/org.wso2.carbon.identity.api.server.credential.management From 9dc5aad02ed0cbd8e0bafcdd17dea7638e43c0a4 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 26 Feb 2026 19:11:49 +0530 Subject: [PATCH 03/10] Support requested credentials in VP templates 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. --- .../PresentationDefinitionCreationModel.java | 16 ++--- .../v1/PresentationDefinitionUpdateModel.java | 16 ++--- .../v1/RequestedCredentialModel.java | 61 ++++++++++++++++++ .../ServerVPDefinitionManagementService.java | 63 ++++++++++++++----- .../resources/PresentationDefinitions.yaml | 41 +++++++++--- 5 files changed, 161 insertions(+), 36 deletions(-) create mode 100644 components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java index 55778bb814..210d6fe280 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java @@ -23,6 +23,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.List; + import javax.validation.constraints.NotNull; /** @@ -35,7 +37,7 @@ public class PresentationDefinitionCreationModel { private String name; private String description; @NotNull - private Object definition; + private List requestedCredentials; @ApiModelProperty(required = true, value = "Name of the presentation definition.") @JsonProperty("name") @@ -57,13 +59,13 @@ public void setDescription(String description) { this.description = description; } - @ApiModelProperty(required = true, value = "The full presentation definition JSON object.") - @JsonProperty("definition") - public Object getDefinition() { - return definition; + @ApiModelProperty(required = true, value = "The requested credentials to construct the definition.") + @JsonProperty("requested_credentials") + public List getRequestedCredentials() { + return requestedCredentials; } - public void setDefinition(Object definition) { - this.definition = definition; + public void setRequestedCredentials(List requestedCredentials) { + this.requestedCredentials = requestedCredentials; } } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java index 2214567440..b103aab559 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java @@ -23,6 +23,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.List; + /** * Update model for presentation definition. */ @@ -31,7 +33,7 @@ public class PresentationDefinitionUpdateModel { private String name; private String description; - private Object definition; + private List requestedCredentials; @ApiModelProperty(value = "Name of the presentation definition.") @JsonProperty("name") @@ -53,13 +55,13 @@ public void setDescription(String description) { this.description = description; } - @ApiModelProperty(value = "The full presentation definition JSON object.") - @JsonProperty("definition") - public Object getDefinition() { - return definition; + @ApiModelProperty(value = "The requested credentials to construct the definition.") + @JsonProperty("requested_credentials") + public List getRequestedCredentials() { + return requestedCredentials; } - public void setDefinition(Object definition) { - this.definition = definition; + public void setRequestedCredentials(List requestedCredentials) { + this.requestedCredentials = requestedCredentials; } } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java new file mode 100644 index 0000000000..395aa271e5 --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java @@ -0,0 +1,61 @@ +package org.wso2.carbon.identity.api.server.vp.template.management.v1; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * Requested Credential Model. + */ +@ApiModel(description = "Requested Credential Model") +public class RequestedCredentialModel { + + @NotNull + private String type; + private String purpose; + private String issuer; + private List requestedClaims; + + @ApiModelProperty(required = true, value = "Type of the requested credential.") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @ApiModelProperty(value = "Purpose of requesting the credential.") + @JsonProperty("purpose") + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + @ApiModelProperty(value = "The trusted issuer for this credential.") + @JsonProperty("issuer") + public String getIssuer() { + return issuer; + } + + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + @ApiModelProperty(value = "List of claims requested from this credential.") + @JsonProperty("requested_claims") + public List getRequestedClaims() { + return requestedClaims; + } + + public void setRequestedClaims(List requestedClaims) { + this.requestedClaims = requestedClaims; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index a810dc8624..328bb1e38a 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -28,12 +28,16 @@ import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionListItem; import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionResponse; import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionUpdateModel; +import org.wso2.carbon.identity.api.server.vp.template.management.v1.RequestedCredentialModel; import org.wso2.carbon.identity.openid4vc.presentation.common.exception.PresentationDefinitionNotFoundException; import org.wso2.carbon.identity.openid4vc.presentation.common.exception.VPException; import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition; +import org.wso2.carbon.identity.openid4vc.presentation.common.util.PresentationDefinitionUtil; import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; +import java.util.ArrayList; import java.util.List; +import java.util.UUID; import java.util.stream.Collectors; import javax.ws.rs.core.Response; @@ -83,9 +87,34 @@ public PresentationDefinitionResponse createPresentationDefinition( int tenantId = getTenantId(); PresentationDefinitionService service = getService(); - String definitionJson = serializeDefinition(creationModel.getDefinition()); + String definitionId = UUID.randomUUID().toString(); + List requestedCredentials = creationModel.getRequestedCredentials(); + List inputDescriptors = new ArrayList<>(); + int descIndex = 1; + if (requestedCredentials != null) { + for (RequestedCredentialModel reqCred : requestedCredentials) { + String descId = reqCred.getType() != null ? + reqCred.getType().toLowerCase() + "_descriptor" + descIndex : + "descriptor_" + descIndex; + inputDescriptors.add( + PresentationDefinitionUtil.buildInputDescriptorFromRequestedCredential( + descId, reqCred.getType(), reqCred.getPurpose(), reqCred.getIssuer(), + reqCred.getRequestedClaims())); + descIndex++; + } + } + + String definitionJson = null; + if (!inputDescriptors.isEmpty()) { + definitionJson = PresentationDefinitionUtil.buildPresentationDefinition( + definitionId, creationModel.getName(), creationModel.getDescription(), + inputDescriptors.toArray(new String[0])); + } else { + definitionJson = "{}"; // Will fail validation in service layer + } PresentationDefinition definition = new PresentationDefinition.Builder() + .definitionId(definitionId) .name(creationModel.getName()) .description(creationModel.getDescription()) .definitionJson(definitionJson) @@ -145,8 +174,24 @@ public PresentationDefinitionResponse updatePresentationDefinition( int tenantId = getTenantId(); PresentationDefinitionService service = getService(); - String definitionJson = updateModel.getDefinition() != null - ? serializeDefinition(updateModel.getDefinition()) : null; + String definitionJson = null; + if (updateModel.getRequestedCredentials() != null && !updateModel.getRequestedCredentials().isEmpty()) { + List inputDescriptors = new ArrayList<>(); + int descIndex = 1; + for (RequestedCredentialModel reqCred : updateModel.getRequestedCredentials()) { + String descId = reqCred.getType() != null ? + reqCred.getType().toLowerCase() + "_descriptor" + descIndex : + "descriptor_" + descIndex; + inputDescriptors.add( + PresentationDefinitionUtil.buildInputDescriptorFromRequestedCredential( + descId, reqCred.getType(), reqCred.getPurpose(), reqCred.getIssuer(), + reqCred.getRequestedClaims())); + descIndex++; + } + definitionJson = PresentationDefinitionUtil.buildPresentationDefinition( + definitionId, updateModel.getName(), updateModel.getDescription(), + inputDescriptors.toArray(new String[0])); + } PresentationDefinition definition = new PresentationDefinition.Builder() .definitionId(definitionId) @@ -220,18 +265,6 @@ private PresentationDefinitionListItem toListItem(PresentationDefinition definit return item; } - private String serializeDefinition(Object definition) { - - if (definition == null) { - return null; - } - try { - return OBJECT_MAPPER.writeValueAsString(definition); - } catch (Exception e) { - return definition.toString(); - } - } - // --- Error handling --- private javax.ws.rs.WebApplicationException handleNotFound(String definitionId) { diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml index c7ac3a6d5c..cc1213fc6c 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml @@ -237,11 +237,34 @@ components: type: object description: The full presentation definition JSON object. + RequestedCredentialModel: + type: object + required: + - type + properties: + type: + type: string + description: Type of the requested credential. + example: "EmployeeBadge" + purpose: + type: string + description: Purpose of requesting the credential. + example: "Please share your employee badge to prove employment." + issuer: + type: string + description: The trusted issuer for this credential. + requested_claims: + type: array + description: List of claims requested from this credential. + items: + type: string + example: "email" + PresentationDefinitionCreationModel: type: object required: - name - - definition + - requested_credentials properties: name: type: string @@ -251,9 +274,11 @@ components: type: string description: Description of the presentation definition. example: "Verifies employee credentials" - definition: - type: object - description: The full presentation definition JSON object. + requested_credentials: + type: array + description: The requested credentials to construct the definition. + items: + $ref: '#/components/schemas/RequestedCredentialModel' PresentationDefinitionUpdateModel: type: object @@ -265,9 +290,11 @@ components: description: type: string description: Description of the presentation definition. - definition: - type: object - description: The full presentation definition JSON object. + requested_credentials: + type: array + description: The requested credentials to construct the definition. + items: + $ref: '#/components/schemas/RequestedCredentialModel' PresentationDefinitionList: type: object From 0f475d2652a591567c6fec6f58f2825ec780d59c Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 5 Mar 2026 07:16:18 +0530 Subject: [PATCH 04/10] Switch to RequestedCredential objects 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. --- .../ServerVPDefinitionManagementService.java | 110 ++++++++---------- 1 file changed, 49 insertions(+), 61 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index 328bb1e38a..08e8e5301e 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -18,7 +18,6 @@ package org.wso2.carbon.identity.api.server.vp.template.management.v1.core; -import com.fasterxml.jackson.databind.ObjectMapper; import org.wso2.carbon.identity.api.server.common.ContextLoader; import org.wso2.carbon.identity.api.server.vp.template.management.common.VPDefinitionManagementConstants.ErrorMessage; import org.wso2.carbon.identity.api.server.vp.template.management.common.VPDefinitionManagementServiceHolder; @@ -32,7 +31,7 @@ import org.wso2.carbon.identity.openid4vc.presentation.common.exception.PresentationDefinitionNotFoundException; import org.wso2.carbon.identity.openid4vc.presentation.common.exception.VPException; import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition; -import org.wso2.carbon.identity.openid4vc.presentation.common.util.PresentationDefinitionUtil; +import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition.RequestedCredential; import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; import java.util.ArrayList; @@ -47,8 +46,6 @@ */ public class ServerVPDefinitionManagementService { - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - /** * List all presentation definitions for the current tenant. * @@ -88,36 +85,12 @@ public PresentationDefinitionResponse createPresentationDefinition( PresentationDefinitionService service = getService(); String definitionId = UUID.randomUUID().toString(); - List requestedCredentials = creationModel.getRequestedCredentials(); - List inputDescriptors = new ArrayList<>(); - int descIndex = 1; - if (requestedCredentials != null) { - for (RequestedCredentialModel reqCred : requestedCredentials) { - String descId = reqCred.getType() != null ? - reqCred.getType().toLowerCase() + "_descriptor" + descIndex : - "descriptor_" + descIndex; - inputDescriptors.add( - PresentationDefinitionUtil.buildInputDescriptorFromRequestedCredential( - descId, reqCred.getType(), reqCred.getPurpose(), reqCred.getIssuer(), - reqCred.getRequestedClaims())); - descIndex++; - } - } - - String definitionJson = null; - if (!inputDescriptors.isEmpty()) { - definitionJson = PresentationDefinitionUtil.buildPresentationDefinition( - definitionId, creationModel.getName(), creationModel.getDescription(), - inputDescriptors.toArray(new String[0])); - } else { - definitionJson = "{}"; // Will fail validation in service layer - } PresentationDefinition definition = new PresentationDefinition.Builder() .definitionId(definitionId) .name(creationModel.getName()) .description(creationModel.getDescription()) - .definitionJson(definitionJson) + .requestedCredentials(toRequestedCredentials(creationModel.getRequestedCredentials())) .tenantId(tenantId) .build(); @@ -174,30 +147,15 @@ public PresentationDefinitionResponse updatePresentationDefinition( int tenantId = getTenantId(); PresentationDefinitionService service = getService(); - String definitionJson = null; - if (updateModel.getRequestedCredentials() != null && !updateModel.getRequestedCredentials().isEmpty()) { - List inputDescriptors = new ArrayList<>(); - int descIndex = 1; - for (RequestedCredentialModel reqCred : updateModel.getRequestedCredentials()) { - String descId = reqCred.getType() != null ? - reqCred.getType().toLowerCase() + "_descriptor" + descIndex : - "descriptor_" + descIndex; - inputDescriptors.add( - PresentationDefinitionUtil.buildInputDescriptorFromRequestedCredential( - descId, reqCred.getType(), reqCred.getPurpose(), reqCred.getIssuer(), - reqCred.getRequestedClaims())); - descIndex++; - } - definitionJson = PresentationDefinitionUtil.buildPresentationDefinition( - definitionId, updateModel.getName(), updateModel.getDescription(), - inputDescriptors.toArray(new String[0])); - } + List credentials = updateModel.getRequestedCredentials() != null + ? toRequestedCredentials(updateModel.getRequestedCredentials()) + : null; PresentationDefinition definition = new PresentationDefinition.Builder() .definitionId(definitionId) .name(updateModel.getName()) .description(updateModel.getDescription()) - .definitionJson(definitionJson) + .requestedCredentials(credentials) .tenantId(tenantId) .build(); @@ -207,10 +165,6 @@ public PresentationDefinitionResponse updatePresentationDefinition( } catch (PresentationDefinitionNotFoundException e) { throw handleNotFound(definitionId); } catch (VPException e) { - if (e.getMessage() != null && e.getMessage().contains("Invalid")) { - throw handleClientError(ErrorMessage.ERROR_CODE_INVALID_INPUT, e, - Response.Status.BAD_REQUEST, e.getMessage()); - } throw handleServerError(ErrorMessage.ERROR_CODE_ERROR_UPDATING_DEFINITION, e, definitionId); } @@ -238,21 +192,55 @@ public void deletePresentationDefinition(String definitionId) { // --- Conversion helpers --- + /** + * Convert API RequestedCredentialModel list to domain RequestedCredential list. + */ + private List toRequestedCredentials( + List apiModels) { + + if (apiModels == null) { + return null; + } + List result = new ArrayList<>(); + for (RequestedCredentialModel apiModel : apiModels) { + RequestedCredential cred = new RequestedCredential(); + cred.setType(apiModel.getType()); + cred.setPurpose(apiModel.getPurpose()); + cred.setIssuer(apiModel.getIssuer()); + cred.setClaims(apiModel.getRequestedClaims()); + result.add(cred); + } + return result; + } + + /** + * Convert domain RequestedCredential list to API RequestedCredentialModel list. + */ + private List toCredentialModels( + List domainCredentials) { + + if (domainCredentials == null) { + return null; + } + List result = new ArrayList<>(); + for (RequestedCredential cred : domainCredentials) { + RequestedCredentialModel model = new RequestedCredentialModel(); + model.setType(cred.getType()); + model.setPurpose(cred.getPurpose()); + model.setIssuer(cred.getIssuer()); + model.setRequestedClaims(cred.getClaims()); + result.add(model); + } + return result; + } + private PresentationDefinitionResponse toResponse(PresentationDefinition definition) { PresentationDefinitionResponse response = new PresentationDefinitionResponse(); response.setId(definition.getDefinitionId()); response.setName(definition.getName()); response.setDescription(definition.getDescription()); - - if (definition.getDefinitionJson() != null) { - try { - response.setDefinition( - OBJECT_MAPPER.readValue(definition.getDefinitionJson(), Object.class)); - } catch (Exception e) { - response.setDefinition(definition.getDefinitionJson()); - } - } + response.setDefinition(toCredentialModels(definition.getRequestedCredentials())); return response; } From ee63b6a6a4f982234108969a0451df0143476cf9 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 5 Mar 2026 08:30:22 +0530 Subject: [PATCH 05/10] Replace common/v1 deps with vp.template dependency 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. --- pom.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7b6c1b6ba3..7a5d8d277a 100644 --- a/pom.xml +++ b/pom.xml @@ -812,13 +812,9 @@ org.wso2.carbon.identity.server.api - common - ${project.version} - - - org.wso2.carbon.identity.server.api - v1 + org.wso2.carbon.identity.api.server.vp.template.management.v1 ${project.version} + provided org.wso2.carbon.identity.inbound.auth.oauth2 From ed5348f529e3481d00b8bf6a44a53f85489705ba Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 5 Mar 2026 09:42:36 +0530 Subject: [PATCH 06/10] Use 'credentials' and 'claims' field names 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. --- .../v1/PresentationDefinitionCreationModel.java | 12 ++++++------ .../v1/PresentationDefinitionUpdateModel.java | 12 ++++++------ .../management/v1/RequestedCredentialModel.java | 12 ++++++------ .../v1/core/ServerVPDefinitionManagementService.java | 10 +++++----- .../src/main/resources/PresentationDefinitions.yaml | 8 ++++---- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java index 210d6fe280..b54417d599 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionCreationModel.java @@ -37,7 +37,7 @@ public class PresentationDefinitionCreationModel { private String name; private String description; @NotNull - private List requestedCredentials; + private List credentials; @ApiModelProperty(required = true, value = "Name of the presentation definition.") @JsonProperty("name") @@ -60,12 +60,12 @@ public void setDescription(String description) { } @ApiModelProperty(required = true, value = "The requested credentials to construct the definition.") - @JsonProperty("requested_credentials") - public List getRequestedCredentials() { - return requestedCredentials; + @JsonProperty("credentials") + public List getCredentials() { + return credentials; } - public void setRequestedCredentials(List requestedCredentials) { - this.requestedCredentials = requestedCredentials; + public void setCredentials(List credentials) { + this.credentials = credentials; } } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java index b103aab559..1f646436cf 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionUpdateModel.java @@ -33,7 +33,7 @@ public class PresentationDefinitionUpdateModel { private String name; private String description; - private List requestedCredentials; + private List credentials; @ApiModelProperty(value = "Name of the presentation definition.") @JsonProperty("name") @@ -56,12 +56,12 @@ public void setDescription(String description) { } @ApiModelProperty(value = "The requested credentials to construct the definition.") - @JsonProperty("requested_credentials") - public List getRequestedCredentials() { - return requestedCredentials; + @JsonProperty("credentials") + public List getCredentials() { + return credentials; } - public void setRequestedCredentials(List requestedCredentials) { - this.requestedCredentials = requestedCredentials; + public void setCredentials(List credentials) { + this.credentials = credentials; } } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java index 395aa271e5..7471d589e6 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/RequestedCredentialModel.java @@ -17,7 +17,7 @@ public class RequestedCredentialModel { private String type; private String purpose; private String issuer; - private List requestedClaims; + private List claims; @ApiModelProperty(required = true, value = "Type of the requested credential.") @JsonProperty("type") @@ -50,12 +50,12 @@ public void setIssuer(String issuer) { } @ApiModelProperty(value = "List of claims requested from this credential.") - @JsonProperty("requested_claims") - public List getRequestedClaims() { - return requestedClaims; + @JsonProperty("claims") + public List getClaims() { + return claims; } - public void setRequestedClaims(List requestedClaims) { - this.requestedClaims = requestedClaims; + public void setClaims(List claims) { + this.claims = claims; } } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index 08e8e5301e..50bf5a3786 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -90,7 +90,7 @@ public PresentationDefinitionResponse createPresentationDefinition( .definitionId(definitionId) .name(creationModel.getName()) .description(creationModel.getDescription()) - .requestedCredentials(toRequestedCredentials(creationModel.getRequestedCredentials())) + .requestedCredentials(toRequestedCredentials(creationModel.getCredentials())) .tenantId(tenantId) .build(); @@ -147,8 +147,8 @@ public PresentationDefinitionResponse updatePresentationDefinition( int tenantId = getTenantId(); PresentationDefinitionService service = getService(); - List credentials = updateModel.getRequestedCredentials() != null - ? toRequestedCredentials(updateModel.getRequestedCredentials()) + List credentials = updateModel.getCredentials() != null + ? toRequestedCredentials(updateModel.getCredentials()) : null; PresentationDefinition definition = new PresentationDefinition.Builder() @@ -207,7 +207,7 @@ private List toRequestedCredentials( cred.setType(apiModel.getType()); cred.setPurpose(apiModel.getPurpose()); cred.setIssuer(apiModel.getIssuer()); - cred.setClaims(apiModel.getRequestedClaims()); + cred.setClaims(apiModel.getClaims()); result.add(cred); } return result; @@ -228,7 +228,7 @@ private List toCredentialModels( model.setType(cred.getType()); model.setPurpose(cred.getPurpose()); model.setIssuer(cred.getIssuer()); - model.setRequestedClaims(cred.getClaims()); + model.setClaims(cred.getClaims()); result.add(model); } return result; diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml index cc1213fc6c..0c0b5140a1 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml @@ -253,7 +253,7 @@ components: issuer: type: string description: The trusted issuer for this credential. - requested_claims: + claims: type: array description: List of claims requested from this credential. items: @@ -264,7 +264,7 @@ components: type: object required: - name - - requested_credentials + - credentials properties: name: type: string @@ -274,7 +274,7 @@ components: type: string description: Description of the presentation definition. example: "Verifies employee credentials" - requested_credentials: + credentials: type: array description: The requested credentials to construct the definition. items: @@ -290,7 +290,7 @@ components: description: type: string description: Description of the presentation definition. - requested_credentials: + credentials: type: array description: The requested credentials to construct the definition. items: From 272e764580e6386b62026bfb1303e37a772d2118 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 5 Mar 2026 10:29:33 +0530 Subject: [PATCH 07/10] Replace definition with credentials list 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. --- .../v1/PresentationDefinitionResponse.java | 14 +++++++------- .../core/ServerVPDefinitionManagementService.java | 2 +- .../main/resources/PresentationDefinitions.yaml | 10 ++++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java index 194b0d343b..1746c2a3a2 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/PresentationDefinitionResponse.java @@ -32,7 +32,7 @@ public class PresentationDefinitionResponse { private String id; private String name; private String description; - private Object definition; + private java.util.List credentials; @ApiModelProperty(value = "Unique identifier of the presentation definition.") @JsonProperty("id") @@ -64,13 +64,13 @@ public void setDescription(String description) { this.description = description; } - @ApiModelProperty(value = "The full presentation definition JSON object.") - @JsonProperty("definition") - public Object getDefinition() { - return definition; + @ApiModelProperty(value = "The list of requested credentials in this presentation definition.") + @JsonProperty("credentials") + public java.util.List getCredentials() { + return credentials; } - public void setDefinition(Object definition) { - this.definition = definition; + public void setCredentials(java.util.List credentials) { + this.credentials = credentials; } } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index 50bf5a3786..420c465ea8 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -240,7 +240,7 @@ private PresentationDefinitionResponse toResponse(PresentationDefinition definit response.setId(definition.getDefinitionId()); response.setName(definition.getName()); response.setDescription(definition.getDescription()); - response.setDefinition(toCredentialModels(definition.getRequestedCredentials())); + response.setCredentials(toCredentialModels(definition.getRequestedCredentials())); return response; } diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml index 0c0b5140a1..c04a8e24b8 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/resources/PresentationDefinitions.yaml @@ -219,7 +219,7 @@ components: required: - id - name - - definition + - credentials properties: id: type: string @@ -233,9 +233,11 @@ components: type: string description: Description of the presentation definition. example: "Verifies employee credentials" - definition: - type: object - description: The full presentation definition JSON object. + credentials: + type: array + description: The list of requested credentials in this presentation definition. + items: + $ref: '#/components/schemas/RequestedCredentialModel' RequestedCredentialModel: type: object From 4b2c406b7971b7af516fdd2858582bcdef83f1a0 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 12 Mar 2026 12:26:17 +0530 Subject: [PATCH 08/10] Update openid4vc artifact & imports to management 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. --- .../pom.xml | 2 +- .../management/common/VPDefinitionManagementServiceHolder.java | 2 +- .../pom.xml | 2 +- .../management/v1/core/ServerVPDefinitionManagementService.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml index ed273f8655..27c4ea810b 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml @@ -38,7 +38,7 @@ org.wso2.carbon.identity.openid4vc - org.wso2.carbon.identity.openid4vc.presentation.definition + org.wso2.carbon.identity.openid4vc.presentation.management provided diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java index eef757035a..9e28d0aebd 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/common/VPDefinitionManagementServiceHolder.java @@ -19,7 +19,7 @@ package org.wso2.carbon.identity.api.server.vp.template.management.common; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; +import org.wso2.carbon.identity.openid4vc.presentation.management.service.PresentationDefinitionService; /** * Service holder for VP Definition Management. diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml index c7799f3b08..a56b9635f1 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/pom.xml @@ -87,7 +87,7 @@ org.wso2.carbon.identity.openid4vc - org.wso2.carbon.identity.openid4vc.presentation.definition + org.wso2.carbon.identity.openid4vc.presentation.management provided diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index 420c465ea8..80b57bcb2c 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -32,7 +32,7 @@ import org.wso2.carbon.identity.openid4vc.presentation.common.exception.VPException; import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition; import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition.RequestedCredential; -import org.wso2.carbon.identity.openid4vc.presentation.definition.service.PresentationDefinitionService; +import org.wso2.carbon.identity.openid4vc.presentation.management.service.PresentationDefinitionService; import java.util.ArrayList; import java.util.List; From a9a7b36c538004af034fb2dbaa568b2599b39a46 Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Thu, 12 Mar 2026 12:51:54 +0530 Subject: [PATCH 09/10] Switch to presentation.management module 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. --- .../v1/core/ServerVPDefinitionManagementService.java | 6 +++--- pom.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java index 80b57bcb2c..9542ae2355 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.v1/src/main/java/org/wso2/carbon/identity/api/server/vp/template/management/v1/core/ServerVPDefinitionManagementService.java @@ -28,10 +28,10 @@ import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionResponse; import org.wso2.carbon.identity.api.server.vp.template.management.v1.PresentationDefinitionUpdateModel; import org.wso2.carbon.identity.api.server.vp.template.management.v1.RequestedCredentialModel; -import org.wso2.carbon.identity.openid4vc.presentation.common.exception.PresentationDefinitionNotFoundException; import org.wso2.carbon.identity.openid4vc.presentation.common.exception.VPException; -import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition; -import org.wso2.carbon.identity.openid4vc.presentation.common.model.PresentationDefinition.RequestedCredential; +import org.wso2.carbon.identity.openid4vc.presentation.management.exception.PresentationDefinitionNotFoundException; +import org.wso2.carbon.identity.openid4vc.presentation.management.model.PresentationDefinition; +import org.wso2.carbon.identity.openid4vc.presentation.management.model.PresentationDefinition.RequestedCredential; import org.wso2.carbon.identity.openid4vc.presentation.management.service.PresentationDefinitionService; import java.util.ArrayList; diff --git a/pom.xml b/pom.xml index 7a5d8d277a..8132c87086 100644 --- a/pom.xml +++ b/pom.xml @@ -911,7 +911,7 @@ org.wso2.carbon.identity.openid4vc - org.wso2.carbon.identity.openid4vc.presentation.definition + org.wso2.carbon.identity.openid4vc.presentation.management ${carbon.identity.openid4vc.version} provided From 99ae0765661a63b0e03c3d52a7bf78271eaa958e Mon Sep 17 00:00:00 2001 From: Udeepa_Gallage <117582139+udeepa15@users.noreply.github.com> Date: Fri, 13 Mar 2026 10:27:04 +0530 Subject: [PATCH 10/10] Update copyright year to 2026 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. --- .../pom.xml | 2 +- .../management/common/VPDefinitionManagementConstants.java | 2 +- .../management/common/VPDefinitionManagementServiceHolder.java | 2 +- .../pom.xml | 2 +- .../identity/api/server/vp/template/management/v1/Error.java | 2 +- .../management/v1/PresentationDefinitionCreationModel.java | 2 +- .../vp/template/management/v1/PresentationDefinitionList.java | 2 +- .../template/management/v1/PresentationDefinitionListItem.java | 2 +- .../template/management/v1/PresentationDefinitionResponse.java | 2 +- .../management/v1/PresentationDefinitionUpdateModel.java | 2 +- .../vp/template/management/v1/PresentationDefinitionsApi.java | 2 +- .../management/v1/PresentationDefinitionsApiService.java | 2 +- .../v1/factories/PresentationDefinitionsApiServiceFactory.java | 2 +- .../management/v1/core/ServerVPDefinitionManagementService.java | 2 +- .../v1/impl/PresentationDefinitionsApiServiceImpl.java | 2 +- .../pom.xml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml index 27c4ea810b..6bb5710dc8 100644 --- a/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.vp.template.management/org.wso2.carbon.identity.api.server.vp.template.management.common/pom.xml @@ -1,6 +1,6 @@