diff --git a/certify-service/src/main/java/io/mosip/certify/config/TemplatesLoader.java b/certify-service/src/main/java/io/mosip/certify/config/TemplatesLoader.java deleted file mode 100644 index 80e6232d..00000000 --- a/certify-service/src/main/java/io/mosip/certify/config/TemplatesLoader.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -/* This is for temporary purpose till an API isn’t added to simplify Issuer onboarding. */ - -package io.mosip.certify.config; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import io.mosip.certify.entity.RenderingTemplate; -import io.mosip.certify.repository.RenderingTemplateRepository; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.CommandLineRunner; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.web.client.RestTemplate; - -import java.io.IOException; -import java.nio.file.Files; -import java.time.LocalDateTime; -import java.util.*; - - -@Configuration -@Slf4j -public class TemplatesLoader implements CommandLineRunner { - @Autowired - RenderingTemplateRepository svgRenderTemplateRepository; - - @Value("${mosip.certify.rendering-templates:}") - private String svgTemplateJson; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private RestTemplate restTemplate; - - @Override - public void run(String... args) throws Exception { - Long count = svgRenderTemplateRepository.count(); - if (count != 0) { - return; - } - String svgTemplateContent = ""; - - if(svgTemplateJson.startsWith("http")) { - svgTemplateContent = restTemplate.getForObject(svgTemplateJson, String.class); - } else { - Resource resource = new ClassPathResource(svgTemplateJson); - // TODO: Verify this w.r.t local path - try { - svgTemplateContent = (Files.readString(resource.getFile().toPath())); - } catch (IOException e) { - log.error("Missing local json file for referring svg templates", e); - } - } - - if(!svgTemplateContent.isEmpty()) { - try { - List svgTemplateMap = objectMapper.readValue(svgTemplateContent, List.class); - svgTemplateMap.forEach((value) -> { - RenderingTemplate svgRenderTemplate = new RenderingTemplate(); - LinkedHashMap valueMap = (LinkedHashMap) value; - String id = valueMap.get("id").toString(); - svgRenderTemplate.setId(id); - String templateURI = valueMap.get("content").toString(); - if(templateURI.startsWith("http")) { - String templateFromUrl = restTemplate.getForObject(templateURI, String.class); - svgRenderTemplate.setTemplate(templateFromUrl); - } else { - svgRenderTemplate.setTemplate(templateURI); - } - LocalDateTime localDateTime = LocalDateTime.now(); - svgRenderTemplate.setCreatedtimes(localDateTime); - svgRenderTemplate.setUpdatedtimes(localDateTime); - log.info("Template inserted in svg template table."); - svgRenderTemplateRepository.save(svgRenderTemplate); - }); - } catch (JsonProcessingException e) { - log.error("Missing configuration for svg template content " + e.getMessage()); - } - - } - log.info("=============== CERTIFY TEMPLATE SETUP COMPLETED ==============="); - } -} diff --git a/certify-service/src/main/resources/application-local.properties.rej b/certify-service/src/main/resources/application-local.properties.rej deleted file mode 100644 index bc5e19d8..00000000 --- a/certify-service/src/main/resources/application-local.properties.rej +++ /dev/null @@ -1,63 +0,0 @@ -diff a/certify-service/src/main/resources/application-local.properties b/certify-service/src/main/resources/application-local.properties (rejected hunks) -@@ -14,7 +14,7 @@ mosip.certify.security.ignore-auth-urls=/actuator/**,**/error,**/swagger-ui/**,\ - - - ## ------------------------------------------ Discovery openid-configuration ------------------------------------------- --mosipbox.public.url=http://localhost:8090 -+mosipbox.public.url=https://injicertify.qa-inji.mosip.net - mosip.certify.discovery.issuer-id=${mosipbox.public.url}${server.servlet.path} - - ##--------------change this later--------------------------------- -@@ -22,11 +22,11 @@ mosip.certify.supported.jwt-proof-alg={'RS256','PS256'} - - ## ---------------------------------------------- VCI ------------------------------------------------------------------ - ##----- These are properties for any oauth resource server providing jwk------------### --mosip.certify.identifier=http://localhost:8090 -+mosip.certify.identifier=https://injicertify.qa-inji.mosip.net - mosip.certify.authn.filter-urls={ '${server.servlet.path}/issuance/credential', '${server.servlet.path}/issuance/vd12/credential', '${server.servlet.path}/issuance/vd11/credential'} - mosip.certify.authn.issuer-uri=http://localhost:8088/v1/esignet - mosip.certify.authn.jwk-set-uri=http://localhost:8088/v1/esignet/oauth/.well-known/jwks.json --mosip.certify.authn.allowed-audiences={ '${mosipbox.public.url}${server.servlet.path}/issuance/credential', 'http://localhost:8088/v1/esignet/vci/credential' } -+mosip.certify.authn.allowed-audiences={ '${mosipbox.public.url}${server.servlet.path}/issuance/credential', 'http://localhost:8088/v1/esignet/vci/credential', 'https://injicertify.qa-inji.mosip.net' } - - mosip.certify.key-values={\ - 'v11' : {\ -@@ -159,12 +159,12 @@ mosip.certify.key-values={\ - 'credential_configurations_supported' : { \ - "InsuranceCredential" : {\ - 'format': 'ldp_vc',\ -- 'scope' : 'sunbird_rc_insurance_vc_ldp',\ -+ 'scope' : 'sample_vc_ldp',\ - 'cryptographic_binding_methods_supported': {'did:jwk'},\ - 'credential_signing_alg_values_supported': {'Ed25519Signature2020'},\ - 'proof_types_supported': {'jwt': {'proof_signing_alg_values_supported': {'RS256', 'PS256'}}},\ - 'credential_definition': {\ -- 'type': {'VerifiableCredential','InsuranceCredential'},\ -+ 'type': {'VerifiableCredential','MockVerifiableCredential'},\ - 'credentialSubject': {\ - 'fullName': {'display': {{'name': 'Name','locale': 'en'}}}, \ - 'mobile': {'display': {{'name': 'Phone Number','locale': 'en'}}},\ -@@ -187,7 +187,7 @@ mosip.certify.key-values={\ - },\ - "LifeInsuranceCredential":{\ - 'format': 'ldp_vc',\ -- 'scope' : 'life_insurance_vc_ldp',\ -+ 'scope' : 'sample_vc_ldp',\ - 'cryptographic_binding_methods_supported': {'did:jwk'},\ - 'credential_signing_alg_values_supported': {'Ed25519Signature2020'},\ - 'proof_types_supported': {'jwt': {'proof_signing_alg_values_supported': {'RS256', 'ES256'}}},\ -@@ -252,11 +252,11 @@ mosip.certify.cache.security.secretkey.reference-id=TRANSACTION_CACHE - mosip.certify.cache.security.algorithm-name=AES/ECB/PKCS5Padding - - #spring.cache.type=redis --#spring.data.redis.host=localhost --#spring.data.redis.port=6379 -+spring.data.redis.host=localhost -+spring.data.redis.port=6379 - #spring.data.redis.password=eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81 - --spring.cache.type=simple -+spring.cache.type=redis - spring.cache.cache-names=${mosip.certify.cache.names} - management.health.redis.enabled=false -