diff --git a/certify-service/configure_start.sh b/certify-service/configure_start.sh index 71783552..48af1bff 100644 --- a/certify-service/configure_start.sh +++ b/certify-service/configure_start.sh @@ -25,9 +25,6 @@ download_and_extract() { if [ "$enable_certify_artifactory" = "true" ]; then download_and_extract "${artifactory_url_env}/artifactory/libs-release-local/certify/certify-plugin.zip" "${loader_path_env}" - echo "Please patch plugin JAR now" - sleep 60 - echo "Plugin JAR patching not posssible now" fi #installs the pkcs11 libraries. diff --git a/certify-service/src/main/java/io/mosip/certify/config/TemplateConfig.java b/certify-service/src/main/java/io/mosip/certify/config/TemplateConfig.java index 87420180..c4b9e406 100644 --- a/certify-service/src/main/java/io/mosip/certify/config/TemplateConfig.java +++ b/certify-service/src/main/java/io/mosip/certify/config/TemplateConfig.java @@ -47,13 +47,19 @@ public class TemplateConfig implements CommandLineRunner { public void run(String... args) throws Exception { String svgTemplateContent = ""; List svgTemplateMap; - Resource resource = new ClassPathResource(svgTemplateJson); - try { - svgTemplateContent = (Files.readString(resource.getFile().toPath())); - } catch (IOException e) { - log.error("Missing local json file for referring svg templates", e); + + if(svgTemplateJson.startsWith("http")) { + svgTemplateContent = restTemplate.getForObject(svgTemplateJson, String.class); + } else { + Resource resource = new ClassPathResource(svgTemplateJson); + 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 { svgTemplateMap = objectMapper.readValue(svgTemplateContent, List.class); diff --git a/db_scripts/mosip_certify/ddl.sql b/db_scripts/mosip_certify/ddl.sql index 23f57aff..34a4f0f7 100644 --- a/db_scripts/mosip_certify/ddl.sql +++ b/db_scripts/mosip_certify/ddl.sql @@ -3,5 +3,7 @@ \ir ddl/certify-key_alias.sql \ir ddl/certify-key_policy_def.sql \ir ddl/certify-key_store.sql +\ir ddl/certify-svg_template.sql +\ir ddl/template_data.sql diff --git a/db_scripts/mosip_certify/ddl/certify-svg_template.sql b/db_scripts/mosip_certify/ddl/certify-svg_template.sql index 78aabdd0..8ba1730d 100644 --- a/db_scripts/mosip_certify/ddl/certify-svg_template.sql +++ b/db_scripts/mosip_certify/ddl/certify-svg_template.sql @@ -3,8 +3,8 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. -- ------------------------------------------------------------------------------------------------- -- Database Name: inji_certify --- Table Name : svg_render_template --- Purpose : Svg Render Template table +-- Table Name : svg_template +-- Purpose : Svg Template table -- -- -- Modified Date Modified By Comments / Remarks @@ -23,6 +23,5 @@ COMMENT ON TABLE svg_template IS 'SVG Render Template: Contains svg render image COMMENT ON COLUMN svg_template.id IS 'Template Id: Unique id assigned to save and identify template.'; COMMENT ON COLUMN svg_template.template IS 'SVG Template Content: SVG Render Image for the VC details.'; -COMMENT ON COLUMN svg_template.last_modified IS 'Last date when the template was modified.'; - - +COMMENT ON COLUMN svg_template.cr_dtimes IS 'Date when the template was inserted in table.'; +COMMENT ON COLUMN svg_template.upd_dtimes IS 'Date when the template was last updated in table.'; diff --git a/db_scripts/mosip_certify/ddl/template_data.sql b/db_scripts/mosip_certify/ddl/template_data.sql index 2130e644..53c56395 100644 --- a/db_scripts/mosip_certify/ddl/template_data.sql +++ b/db_scripts/mosip_certify/ddl/template_data.sql @@ -1,3 +1,16 @@ +-- 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/. +-- ------------------------------------------------------------------------------------------------- +-- Database Name: inji_certify +-- Table Name : template_data +-- Purpose : Template Data table +-- +-- +-- Modified Date Modified By Comments / Remarks +-- ------------------------------------------------------------------------------------------ +-- ------------------------------------------------------------------------------------------ + CREATE TABLE IF NOT EXISTS template_data( context character varying(1024) NOT NULL, credential_type character varying(512) NOT NULL, @@ -6,3 +19,11 @@ CREATE TABLE IF NOT EXISTS template_data( upd_dtimes timestamp, CONSTRAINT pk_template PRIMARY KEY (context, credential_type) ); + +COMMENT ON TABLE template_data IS 'Template Data: Contains velocity template for VC'; + +COMMENT ON COLUMN svg_template.context IS 'VC Context: Context URL list items separated by comma(,)'; +COMMENT ON COLUMN svg_template.credential_type IS 'Credential Type: Credential type list items separated by comma(,)'; +COMMENT ON COLUMN svg_template.template IS 'Template Content: Velocity Template to generate the VC'; +COMMENT ON COLUMN svg_template.cr_dtimes IS 'Date when the template was inserted in table.'; +COMMENT ON COLUMN svg_template.upd_dtimes IS 'Date when the template was last updated in table.'; diff --git a/docker-compose/docker-compose-certify/certify_init.sql b/docker-compose/docker-compose-certify/certify_init.sql index d57e1bc9..69af4f66 100644 --- a/docker-compose/docker-compose-certify/certify_init.sql +++ b/docker-compose/docker-compose-certify/certify_init.sql @@ -72,6 +72,15 @@ CREATE TABLE certify.svg_template ( CONSTRAINT pk_svgtmp_id PRIMARY KEY (id) ); +CREATE TABLE certify.template_data( + context character varying(1024) NOT NULL, + credential_type character varying(512) NOT NULL, + template VARCHAR NOT NULL, + cr_dtimes timestamp NOT NULL default now(), + upd_dtimes timestamp, + CONSTRAINT pk_template PRIMARY KEY (context, credential_type) +); + INSERT INTO certify.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('ROOT', 2920, 1125, 'NA', true, 'mosipadmin', now()); diff --git a/docker-compose/docker-compose-certify/config/certify-default.properties b/docker-compose/docker-compose-certify/config/certify-default.properties index dd6d54be..700dd974 100644 --- a/docker-compose/docker-compose-certify/config/certify-default.properties +++ b/docker-compose/docker-compose-certify/config/certify-default.properties @@ -45,10 +45,10 @@ mosip.certify.security.ignore-auth-urls=**/actuator/**,**/error,**/swagger-ui/** ## ------------------------------------------ Discovery openid-configuration ------------------------------------------- mosip.certify.discovery.issuer-id=${mosipbox.public.url}${server.servlet.path} mosip.certify.authorization.url=http://localhost:8088 -mosip.certify.svg-templates=svg-template.json ##--------------change this later--------------------------------- mosip.certify.supported.jwt-proof-alg={'RS256','PS256'} +mosip.certify.issuer=PluginIssuer ##----- These are reference to the oauth resource server providing jwk----------------------------------## diff --git a/docker-compose/docker-compose-certify/config/certify-mock-identity.properties b/docker-compose/docker-compose-certify/config/certify-mock-identity.properties index a85029fa..93e08c11 100644 --- a/docker-compose/docker-compose-certify/config/certify-mock-identity.properties +++ b/docker-compose/docker-compose-certify/config/certify-mock-identity.properties @@ -12,41 +12,8 @@ mosip.certify.cache.store.individual-id=true # TODO: Onboard secrets for local build mosip.certify.mock.vciplugin.issuer.key-cert=dummy mosip.certify.mock.vciplugin.ca.key-cert=dummy +mosip.certify.svg-templates=insurance-svg-template.json mosip.certify.key-values={\ - 'vd11' : { \ - 'credential_issuer': '${mosip.certify.identifier}', \ - 'credential_endpoint': '${mosip.certify.identifier}${server.servlet.path}/issuance/vd11/credential', \ - 'credentials_supported': {\ - {\ - 'format': 'ldp_vc',\ - 'id': 'MockVerifiableCredential_ldp', \ - 'scope' : 'mock_identity_vc_ldp',\ - 'cryptographic_binding_methods_supported': {'did:jwk'},\ - 'cryptographic_suites_supported': {'RsaSignature2018'},\ - 'proof_types_supported': {'jwt'},\ - 'credential_definition': {\ - 'type': {'VerifiableCredential','MockVerifiableCredential'},\ - 'credentialSubject': {\ - 'fullName': { 'display': {{'name': 'Full Name', 'locale': 'en' }}},\ - 'phone': { 'display': {{'name': 'Phone Number', 'locale': 'en' }}},\ - 'dateOfBirth': { 'display': {{'name': 'DOB', 'locale': 'en' }}},\ - 'gender': { 'display': {{'name': 'Gender', 'locale': 'en' }}},\ - 'email': { 'display': {{'name': 'Email Id', 'locale': 'en' }}},\ - 'region': { 'display': {{'name': 'Region', 'locale': 'en' }}},\ - 'province': { 'display': {{'name': 'Province', 'locale': 'en' }}},\ - 'UIN': { 'display': {{'name': 'UIN', 'locale': 'en' }}},\ - 'VID': { 'display': {{'name': 'VID', 'locale': 'en' }}},\ - 'postalCode': { 'display': {{'name': 'Postal Code', 'locale': 'en' }}}\ - }\ - },\ - 'display': {{'name': 'Mock Verifiable Credential', \ - 'locale': 'en', \ - 'logo': {'url': '${mosipbox.public.url}/logo.png','alt_text': 'a square logo of a MOSIP'},\ - 'background_color': '#12107c',\ - 'text_color': '#FFFFFF'}}\ - }\ - }\ - },\ 'vd12' : {\ 'credential_issuer': '${mosip.certify.identifier}', \ 'authorization_servers': {'${mosip.certify.authorization.url}'}, \ @@ -134,5 +101,59 @@ mosip.certify.key-values={\ 'order' : {'org.iso.18013.5.1~family_name','org.iso.18013.5.1~given_name','org.iso.18013.5.1~document_number','org.iso.18013.5.1~issuing_country','org.iso.18013.5.1~issue_date','org.iso.18013.5.1~expiry_date','org.iso.18013.5.1~birth_date'}\ }\ }\ + },\ + 'vd13.1' : {\ + 'credential_issuer': '${mosip.certify.identifier}', \ + 'authorization_servers': {'${mosip.certify.authorization.url}'}, \ + 'credential_endpoint': '${mosip.certify.identifier}${server.servlet.path}/issuance/credential', \ + 'svg_template_endpoint': '${mosip.certify.domain.url}${server.servlet.path}/public/svg-template/5b9c2a12-810a-7388-2dc8-13ee7ad88bac', \ + 'display': {{'name': 'Mock Verifiable Credential', 'locale': 'en'}},\ + 'credential_configurations_supported' : { \ + 'MockVerifiableCredential_ldp' : {\ + 'format': 'ldp_vc',\ + 'scope' : 'mock_identity_vc_ldp',\ + 'cryptographic_binding_methods_supported': {'did:jwk'},\ + 'credential_signing_alg_values_supported': {'RsaSignature2018'},\ + 'proof_types_supported': {'jwt': {'proof_signing_alg_values_supported': {'RS256', 'PS256', 'ES256'}}},\ + 'credential_definition': {\ + 'type': {'VerifiableCredential','MockVerifiableCredential'},\ + 'credentialSubject': {\ + 'fullName': { 'display': {{'name': 'Full Name', 'locale': 'en' }}},\ + 'phone': { 'display': {{'name': 'Phone Number', 'locale': 'en' }}},\ + 'dateOfBirth': { 'display': {{'name': 'DOB', 'locale': 'en' }}},\ + 'gender': { 'display': {{'name': 'Gender', 'locale': 'en' }}},\ + 'email': { 'display': {{'name': 'Email Id', 'locale': 'en' }}},\ + 'region': { 'display': {{'name': 'Region', 'locale': 'en' }}},\ + 'province': { 'display': {{'name': 'Province', 'locale': 'en' }}},\ + 'UIN': { 'display': {{'name': 'UIN', 'locale': 'en' }}},\ + 'VID': { 'display': {{'name': 'VID', 'locale': 'en' }}},\ + 'postalCode': { 'display': {{'name': 'Postal Code', 'locale': 'en' }}}\ + }},\ + 'display': {{'name': 'Mock Verifiable Credential', \ + 'locale': 'en', \ + 'logo': {'url': '${mosipbox.public.url}/logo.png','alt_text': 'a square logo of a MOSIP'},\ + 'background_color': '#12107c',\ + 'background_image': { 'uri': 'https://${mosipbox.public.url}/inji/mosip-logo.png' }, \ + 'text_color': '#FFFFFF'}},\ + 'order' : {'fullName','phone','dateOfBirth','gender','email','region','province','UIN', 'VID', 'postalCode'}\ + },\ + "DrivingLicenseCredential":{\ + 'format': 'mso_mdoc',\ + 'doctype': 'org.iso.18013.5.1.mDL',\ + 'scope' : 'sample_vc_mdoc',\ + 'cryptographic_binding_methods_supported': {'cose_key'},\ + 'credential_signing_alg_values_supported': {'ES256'},\ + 'proof_types_supported': {'jwt': {'proof_signing_alg_values_supported': {'ES256'}}},\ + 'claims': {\ + 'org.iso.18013.5.1': {'given_name': {'display': {{'name': 'Given Name','locale': 'en'}}},'family_name': {'display': {{'name': 'Family Name','locale': 'en'}}},'issue_date': {'display': {{'name': 'Issue Date','locale': 'en'}}},'expiry_date': {'display': {{'name': 'Expiry Date','locale': 'en'}}},'birth_date': {'display': {{'name': 'Birth Date','locale': 'en'}}},'issuing_country': {'display': {{'name': 'Issuing Country','locale': 'en'}}},'document_number': {'display': {{'name': 'Document Number','locale': 'en'}}}}},\ + 'display': {{'name': 'Mobile Driving License Verifiable Credential', \ + 'locale': 'en', \ + 'background_image': { 'uri': 'https://sunbird.org/images/sunbird-logo-new.png' }, \ + 'logo': {'url': 'https://sunbird.org/images/sunbird-logo-new.png','alt_text': 'a square logo of a Sunbird Mobile Driving License'},\ + 'background_color': '#FDFAF9',\ + 'text_color': '#7C4616'}},\ + 'order' : {'org.iso.18013.5.1~family_name','org.iso.18013.5.1~given_name','org.iso.18013.5.1~document_number','org.iso.18013.5.1~issuing_country','org.iso.18013.5.1~issue_date','org.iso.18013.5.1~expiry_date','org.iso.18013.5.1~birth_date'}\ + }\ + }\ }\ } \ No newline at end of file diff --git a/docker-compose/docker-compose-certify/config/certify-sunbird-insurance.properties b/docker-compose/docker-compose-certify/config/certify-sunbird-insurance.properties index 3a7738c0..c94323e5 100644 --- a/docker-compose/docker-compose-certify/config/certify-sunbird-insurance.properties +++ b/docker-compose/docker-compose-certify/config/certify-sunbird-insurance.properties @@ -30,75 +30,14 @@ mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-sche mosip.certify.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-search-url=http://sunbird-registry:80/registry/api/v1/Insurance/search +mosip.certify.svg-templates=insurance-svg-template.json mosip.certify.key-values={\ - 'vd11' : {\ - 'credential_issuer': '${mosipbox.public.url}', \ - 'authorization_server': '${mosip.certify.authorization.url}', \ - 'credential_endpoint': '${mosipbox.public.url}${server.servlet.path}/issuance/vd11/credential', \ - 'display': {{'name': 'Insurance', 'locale': 'en'}},\ - 'credentials_supported': {{\ - 'format': 'ldp_vc',\ - 'id': 'InsuranceCredential', \ - 'scope' : 'sunbird_rc_insurance_vc_ldp',\ - 'cryptographic_binding_methods_supported': {'did:jwk'},\ - 'cryptographic_suites_supported': {'Ed25519Signature2020'},\ - 'proof_types_supported': {'jwt'},\ - 'credential_definition': {\ - 'type': {'VerifiableCredential','InsuranceCredential'},\ - 'credentialSubject': {\ - 'fullName': {'display': {{'name': 'Name','locale': 'en'}}}, \ - 'mobile': {'display': {{'name': 'Phone Number','locale': 'en'}}},\ - 'dob': {'display': {{'name': 'Date of Birth','locale': 'en'}}},\ - 'gender': {'display': {{'name': 'Gender','locale': 'en'}}},\ - 'benefits': {'display': {{'name': 'Benefits','locale': 'en'}}},\ - 'email': {'display': {{'name': 'Email Id','locale': 'en'}}},\ - 'policyIssuedOn': {'display': {{'name': 'Policy Issued On','locale': 'en'}}},\ - 'policyExpiresOn': {'display': {{'name': 'Policy Expires On','locale': 'en'}}},\ - 'policyName': {'display': {{'name': 'Policy Name','locale': 'en'}}},\ - 'policyNumber': {'display': {{'name': 'Policy Number','locale': 'en'}}}\ - }},\ - 'display': {{'name': 'Sunbird RC Insurance Verifiable Credential', \ - 'locale': 'en', \ - 'logo': {'url': 'https://sunbird.org/images/sunbird-logo-new.png', 'alt_text': 'a square logo of a Sunbird'},\ - 'background_color': '#FDFAF9',\ - 'text_color': '#7C4616'}},\ - 'order' : {'fullName','policyName','policyExpiresOn','policyIssuedOn','policyNumber','mobile','dob','gender','benefits','email'}\ - },\ - {\ - 'format': 'ldp_vc',\ - 'id': 'LifeInsuranceCredential', \ - 'scope' : 'life_insurance_vc_ldp',\ - 'cryptographic_binding_methods_supported': {'did:jwk'},\ - 'cryptographic_suites_supported': {'Ed25519Signature2020'},\ - 'proof_types_supported': {'jwt'},\ - 'credential_definition': {\ - 'type': {'VerifiableCredential'},\ - 'credentialSubject': {\ - 'fullName': {'display': {{'name': 'Name','locale': 'en'}}}, \ - 'mobile': {'display': {{'name': 'Phone Number','locale': 'en'}}},\ - 'dob': {'display': {{'name': 'Date of Birth','locale': 'en'}}},\ - 'gender': {'display': {{'name': 'Gender','locale': 'en'}}},\ - 'benefits': {'display': {{'name': 'Benefits','locale': 'en'}}},\ - 'email': {'display': {{'name': 'Email Id','locale': 'en'}}},\ - 'policyIssuedOn': {'display': {{'name': 'Policy Issued On','locale': 'en'}}},\ - 'policyExpiresOn': {'display': {{'name': 'Policy Expires On','locale': 'en'}}},\ - 'policyName': {'display': {{'name': 'Policy Name','locale': 'en'}}},\ - 'policyNumber': {'display': {{'name': 'Policy Number','locale': 'en'}}}\ - }},\ - 'display': {{'name': 'Life Insurance Verifiable Credential', \ - 'locale': 'en', \ - 'logo': {'url': 'https://sunbird.org/images/sunbird-logo-new.png','alt_text': 'a square logo of a Sunbird'},\ - 'background_color': '#FDFAF9',\ - 'text_color': '#7C4616'}},\ - 'order' : {'fullName','policyName','policyExpiresOn','policyIssuedOn','policyNumber','mobile','dob','gender','benefits','email'}\ - }}\ - },\ - 'vd12' : {\ + 'latest' : {\ 'credential_issuer': '${mosipbox.public.url}', \ 'authorization_servers': {'${mosip.certify.authorization.url}'}, \ - 'credential_endpoint': '${mosipbox.public.url}${server.servlet.path}/issuance/vd12/credential', \ + 'credential_endpoint': '${mosipbox.public.url}${server.servlet.path}/issuance/credential', \ 'display': {{'name': 'Insurance', 'locale': 'en'}},\ - 'credentials_supported' : { \ + 'credential_configurations_supported' : { \ "InsuranceCredential" : {\ 'format': 'ldp_vc',\ 'scope' : 'sunbird_rc_insurance_vc_ldp',\ @@ -123,6 +62,7 @@ mosip.certify.key-values={\ 'locale': 'en', \ 'logo': {'url': 'https://sunbird.org/images/sunbird-logo-new.png','alt_text': 'a square logo of a Sunbird'},\ 'background_color': '#FDFAF9',\ + 'background_image': { 'uri': 'https://sunbird.org/images/sunbird-logo-new.png' }, \ 'text_color': '#7C4616'}},\ 'order' : {'fullName','policyName','policyExpiresOn','policyIssuedOn','policyNumber','mobile','dob','gender','benefits','email'}\ },\ @@ -149,14 +89,18 @@ mosip.certify.key-values={\ 'display': {{'name': 'Life Insurance Verifiable Credential', \ 'locale': 'en', \ 'logo': {'url': 'https://sunbird.org/images/sunbird-logo-new.png','alt_text': 'a square logo of a Sunbird'},\ + 'background_image': { 'uri': 'https://sunbird.org/images/sunbird-logo-new.png' }, \ 'background_color': '#FDFAF9',\ + 'background_image': { 'uri': 'https://sunbird.org/images/sunbird-logo-new.png' }, \ 'text_color': '#7C4616'}},\ 'order' : {'fullName','policyName','policyExpiresOn','policyIssuedOn','policyNumber','mobile','dob','gender','benefits','email'}\ - }}},\ - 'latest' : {\ + }}\ + },\ + 'vd13.1' : {\ 'credential_issuer': '${mosipbox.public.url}', \ 'authorization_servers': {'${mosip.certify.authorization.url}'}, \ 'credential_endpoint': '${mosipbox.public.url}${server.servlet.path}/issuance/credential', \ + 'svg_template_endpoint': '${mosip.certify.domain.url}${server.servlet.path}/public/svg-template/5b9c2a12-810a-7388-2dc8-13ee7ad88bac', \ 'display': {{'name': 'Insurance', 'locale': 'en'}},\ 'credential_configurations_supported' : { \ "InsuranceCredential" : {\ diff --git a/docker-compose/docker-compose-certify/config/insurance-svg-template.json b/docker-compose/docker-compose-certify/config/insurance-svg-template.json new file mode 100644 index 00000000..effea24c --- /dev/null +++ b/docker-compose/docker-compose-certify/config/insurance-svg-template.json @@ -0,0 +1,6 @@ +[ + { + "id": "5b9c2a12-810a-7388-2dc8-13ee7ad88bac", + "content": "\n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n {{credentialSubject/policyName}}\n \n \n {{credentialSubject/policyNumber}}\n \n \n\n \n \n \n Full Name\n \n {{credentialSubject/fullName}}\n \n \n \n\n \n \n\n Phone Number\n \n {{credentialSubject/mobile}}\n \n Gender\n \n {{credentialSubject/gender}}\n \n \n\n \n \n\n Email\n \n {{credentialSubject/email}}\n \n \n\n \n \n \n Policy Issued On\n \n {{credentialSubject/policyIssuedOn}}\n \n Policy Expires On\n \n {{credentialSubject/policyExpiresOn}}\n \n Benefits\n \n \n {{credentialSubject/benefitsLine1}}\n {{credentialSubject/benefitsLine2}}\n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Status\n \n \n Valid\n \n \n \n \n \n \n \n \n\n" + } +] \ No newline at end of file