Skip to content
Merged
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,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<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.vc.template.management</artifactId>
<version>1.3.228-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.vc.template.management.common</artifactId>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.openid4vc</groupId>
<artifactId>org.wso2.carbon.identity.openid4vc.template.management</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* 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.template.management.common;

/**
* Constants related to VC template management.
*/
public final class VCTemplateManagementConstants {

private VCTemplateManagementConstants() {

}

public static final String VC_TEMPLATE_PATH_COMPONENT = "vc-templates";
public static final String PATH_SEPARATOR = "/";
public static final Integer DEFAULT_LIMIT = 10;
public static final String ASC_SORT_ORDER = "ASC";
public static final String DESC_SORT_ORDER = "DESC";

/**
* Error message codes and default messages used in VC config management.
*/
public enum ErrorMessages {
// Client errors
ERROR_CODE_TEMPLATE_ID_MISMATCH("VCM-60001", "Template id path and payload mismatch.",
"Template id in the path does not match the id in the request payload."),
ERROR_CODE_IDENTIFIER_ALREADY_EXISTS("VCM-60002", "Template with the same identifier already exists.",
"A verifiable credential template with the provided identifier already exists in the system."),
ERROR_CODE_EMPTY_FIELD("VCM-60003", "Invalid request.",
"%s cannot be empty."),
ERROR_CODE_INVALID_FIELD("VCM-60004", "Invalid request.",
"%s is invalid."),
ERROR_CODE_TEMPLATE_NOT_FOUND("VCM-60005", "Template not found.",
"Verifiable credential template with the given identifier does not exist."),
ERROR_CODE_UNSUPPORTED_VC_FORMAT("VCM-60006", "Unsupported verifiable credential format.",
"The specified verifiable credential format is not supported."),
ERROR_CODE_OFFER_NOT_FOUND("VCM-60007", "Offer not found.",
"Credential offer for the specified template does not exist."),
ERROR_CODE_INVALID_EXPIRY("VCM-60008", "Invalid expiry value.",
"Expiry must be at least %d seconds."),
ERROR_CODE_INVALID_CLAIM("VCM-60009", "Invalid claim.",
"Invalid claim: %s"),
ERROR_CODE_INVALID_QUERY_PARAM("VCM-60010", "Invalid query parameter.",
"Invalid query parameter : %s"),

// Server errors
ERROR_CODE_PERSISTENCE_ERROR("VCM-65001", "Error while persisting template.",
"An error occurred while storing the verifiable credential template in the database."),
ERROR_CODE_RETRIEVAL_ERROR("VCM-65002", "Error while retrieving template.",
"An error occurred while fetching the verifiable credential template from the database."),
ERROR_CODE_DELETION_ERROR("VCM-65003", "Error while deleting template.",
"An error occurred while removing the verifiable credential template from the database."),
ERROR_CODE_TRANSACTION_ERROR("VCM-65004", "Error in database transaction.",
"A database transaction error occurred while processing the verifiable credential template."),
ERROR_CODE_CLAIM_VALIDATION_ERROR("VCM-65005", "Error while validating claims.",
"Error while validating claims.");

private final String code;
private final String message;
private final String description;

ErrorMessages(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;
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.template.management.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.openid4vc.template.management.VCTemplateManager;

/**
* Service holder for {@link VCTemplateManager} OSGi service.
*/
public final class VCTemplateManagementServiceHolder {

private VCTemplateManagementServiceHolder() {
}

private static class ServiceHolder {

static final VCTemplateManager TEMPLATE_SERVICE = (VCTemplateManager) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(VCTemplateManager.class, null);

}

/**
* Get the {@link VCTemplateManager} OSGi service.
*
* @return The VCTemplateManager service instance.
*/
public static VCTemplateManager getVCTemplateManager() {

return ServiceHolder.TEMPLATE_SERVICE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<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.vc.template.management</artifactId>
<version>1.3.228-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>WSO2 Identity Server - VC Config Management API</name>
<description>WSO2 IS - Verifiable Credential Configuration Management API</description>
<artifactId>org.wso2.carbon.identity.api.server.vc.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.openid4vc</groupId>
<artifactId>org.wso2.carbon.identity.openid4vc.template.management</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.vc.template.management.common</artifactId>
</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>
<!--This plugin is used to generate the API classes from the OpenAPI definition.-->
<!--Uncomment and execute if the API is updated.-->
<!-- <plugin>-->
<!-- <groupId>org.openapitools</groupId>-->
<!-- <artifactId>openapi-generator-maven-plugin</artifactId>-->
<!-- <version>4.1.2</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>generate</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <inputSpec>${project.basedir}/src/main/resources/VCTemplates.yaml</inputSpec>-->
<!-- <generatorName>org.wso2.carbon.codegen.CxfWso2Generator</generatorName>-->
<!-- <configOptions>-->
<!-- <sourceFolder>src/gen/java</sourceFolder>-->
<!-- <apiPackage>org.wso2.carbon.identity.api.server.vc.template.management.v1</apiPackage>-->
<!-- <modelPackage>org.wso2.carbon.identity.api.server.vc.template.management.v1-->
<!-- </modelPackage>-->
<!-- <packageName>org.wso2.carbon.identity.api.server.vc.template.management.v1</packageName>-->
<!-- <dateLibrary>java17</dateLibrary>-->
<!-- <hideGenerationTimestamp>true</hideGenerationTimestamp>-->
<!-- <ignoreFileOverride>${project.basedir}/.openapi-generator-ignore</ignoreFileOverride>-->
<!-- </configOptions>-->
<!-- <output>.</output>-->
<!-- <skipOverwrite>false</skipOverwrite>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>org.openapitools</groupId>-->
<!-- <artifactId>cxf-wso2-openapi-generator</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- </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>
<source>src/extend/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Loading