Skip to content

Commit

Permalink
[INJICERT-495] Added docker compose configurations for insurance and …
Browse files Browse the repository at this point in the history
…mock properties (mosip#110)

* Updated comments in db scripts

Signed-off-by: Piyush7034 <[email protected]>

* Added insurance svg template configurations for docker-compose

Signed-off-by: Piyush7034 <[email protected]>

* Revert configure.sh

Signed-off-by: Piyush7034 <[email protected]>

* Revert configure.sh

Signed-off-by: Piyush7034 <[email protected]>

* Added svg-template and template-data in ddl.sql

Signed-off-by: Piyush7034 <[email protected]>

* Added http config server condition while fetching template json

Signed-off-by: Piyush7034 <[email protected]>

* Removed vd11 and vd12 from docker compose mock and sunbird properties

Signed-off-by: Piyush7034 <[email protected]>

---------

Signed-off-by: Piyush7034 <[email protected]>
  • Loading branch information
Piyush7034 authored Oct 21, 2024
1 parent 1ddbabb commit ca67f72
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 115 deletions.
3 changes: 0 additions & 3 deletions certify-service/configure_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ public class TemplateConfig implements CommandLineRunner {
public void run(String... args) throws Exception {
String svgTemplateContent = "";
List<Object> 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);
Expand Down
2 changes: 2 additions & 0 deletions db_scripts/mosip_certify/ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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


9 changes: 4 additions & 5 deletions db_scripts/mosip_certify/ddl/certify-svg_template.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.';
21 changes: 21 additions & 0 deletions db_scripts/mosip_certify/ddl/template_data.sql
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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.';
9 changes: 9 additions & 0 deletions docker-compose/docker-compose-certify/certify_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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----------------------------------##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}'}, \
Expand Down Expand Up @@ -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'}\
}\
}\
}\
}
Loading

0 comments on commit ca67f72

Please sign in to comment.