Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2026, 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.vp.template.management</artifactId>
<version>1.5.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.vp.template.management.common</artifactId>
<packaging>jar</packaging>
<name>WSO2 Carbon - VP Template Management API Common</name>

<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.openid4vc</groupId>
<artifactId>org.wso2.carbon.identity.openid4vc.presentation.management</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2026, 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.vp.template.management.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;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2026, 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.vp.template.management.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.openid4vc.presentation.management.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);
}
Comment on lines +38 to +43

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 1

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2026, 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.vp.template.management</artifactId>
<version>1.5.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>WSO2 Identity Server - VP Template Management API</name>
<description>WSO2 IS - VP Template Management API</description>
<artifactId>org.wso2.carbon.identity.api.server.vp.template.management.v1</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</exclusion>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.vp.template.management.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.openid4vc</groupId>
<artifactId>org.wso2.carbon.identity.openid4vc.presentation.management</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.openid4vc</groupId>
<artifactId>org.wso2.carbon.identity.openid4vc.presentation.common</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/gen/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2026, 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.vp.template.management.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;
}
}
Loading