diff --git a/sunbird-rc-plugin/src/main/java/io/mosip/esignet/plugin/sunbirdrc/service/SunbirdRCAuthenticationService.java b/sunbird-rc-plugin/src/main/java/io/mosip/esignet/plugin/sunbirdrc/service/SunbirdRCAuthenticationService.java index 2d2e87b..34be71c 100644 --- a/sunbird-rc-plugin/src/main/java/io/mosip/esignet/plugin/sunbirdrc/service/SunbirdRCAuthenticationService.java +++ b/sunbird-rc-plugin/src/main/java/io/mosip/esignet/plugin/sunbirdrc/service/SunbirdRCAuthenticationService.java @@ -74,9 +74,12 @@ public class SunbirdRCAuthenticationService implements Authenticator { @Value("${mosip.ida.kyc.encrypt:false}") private boolean encryptKyc; - @Value("${mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-get-url}") + @Value("${mosip.esignet.sunbird-rc.registry-get-url}") private String registryUrl; + @Value("#{${mosip.sunbird.ida.identity-openid-claims-mapping}}") + private Map oidcClaimsMapping; + @Autowired private RestTemplate restTemplate; @@ -181,12 +184,13 @@ private Map fetchRegistryObject(String entityUrl) throws KycExcha public Map buildKycDataBasedOnPolicy(Map credentialSubject, List claims, String[] locales) { Map kyc = new HashMap<>(); - if (CollectionUtils.isEmpty(Arrays.asList(locales))) { - locales = Arrays.asList(defaultLanguage).toArray(new String[0]); - } - for (String key : claims) { - if (credentialSubject.containsKey(key)) { - kyc.put(key, String.valueOf(credentialSubject.get(key))); + for (String claim : claims) { + if (oidcClaimsMapping.containsKey(claim)) { + String mappedKey = oidcClaimsMapping.get(claim); + if (credentialSubject.containsKey(mappedKey)) { + Object value = credentialSubject.get(mappedKey); + kyc.put(claim, value); + } } } return kyc; diff --git a/sunbird-rc-plugin/src/main/resources/application-local.properties b/sunbird-rc-plugin/src/main/resources/application-local.properties index 80ad480..43b0147 100644 --- a/sunbird-rc-plugin/src/main/resources/application-local.properties +++ b/sunbird-rc-plugin/src/main/resources/application-local.properties @@ -9,27 +9,9 @@ mosip.esignet.authenticator.sunbird-rc.auth-factor.kbi.field-details={{"id":"pol mosip.esignet.authenticator.sunbird-rc.auth-factor.kbi.registry-search-url=https://registry.dev1.mosip.net/api/v1/Insurance/search mosip.esignet.authenticator.sunbird-rc.kbi.entity-id-field=osid +mosip.sunbird.identity-openid-claims-mapping={"fullName":"fullName","name":"fullName","email":"email","phone":"mobile","gender":"gender","dateOfBirth":"dob","birthdate":"dob"} mosip.esignet.vciplugin.sunbird-rc.enable-psut-based-registry-search=false mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-search-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/search mosip.esignet.vciplugin.sunbird-rc.issue-credential-url=http://demo-registry-credentials-service.sunbird:3000/credentials/issue -mosip.esignet.vciplugin.sunbird-rc.supported-credential-types=LifeInsuranceCredential,InsuranceCredential,VehicleInsuranceCredential -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.static-value-map.issuerId=did:web:api.dev1.mosip.net:identity-service:8ebda1d0-665b-4bb7-abc7-d4bf56b6ee09 -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/insurance-credential.json -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-get-url=https://registry.dev1.mosip.net/api/v1/Insurance/ -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-schema-id=did:schema:e1f8df1d-c46c-483c-a882-3fc823666b9f -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-schema-version=1.0.0 - -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.static-value-map.issuerId=did:web:api.dev1.mosip.net:identity-service:8ebda1d0-665b-4bb7-abc7-d4bf56b6ee09 -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/life-insurance-credential.json -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.registry-get-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/ -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.cred-schema-id=did:schema:e1f8df1d-c46c-483c-a882-3fc823666b9f -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.cred-schema-version=1.0.0 -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.registry-search-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/search - -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.static-value-map.issuerId=did:web:holashchand.github.io:test_project:32b08ca7-9979-4f42-aacc-1d73f3ac5322 -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/vehicle-insurance-credential.json -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.registry-get-url=http://10.3.148.107/registry/api/v1/Insurance/ -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.cred-schema-id=did:schema:e95a24f5-d65e-4b65-b497-e0671f8bd12d -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.cred-schema-version=1.0.0 -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.registry-search-url=http://10.3.148.107/registry/api/v1/Insurance/search \ No newline at end of file +mosip.esignet.sunbird-rc.registry-get-url=https://registry.dev1.mosip.net/api/v1/Insurance/ \ No newline at end of file diff --git a/sunbird-rc-plugin/src/test/resources/application-test.properties b/sunbird-rc-plugin/src/test/resources/application-test.properties index 80ad480..43b0147 100644 --- a/sunbird-rc-plugin/src/test/resources/application-test.properties +++ b/sunbird-rc-plugin/src/test/resources/application-test.properties @@ -9,27 +9,9 @@ mosip.esignet.authenticator.sunbird-rc.auth-factor.kbi.field-details={{"id":"pol mosip.esignet.authenticator.sunbird-rc.auth-factor.kbi.registry-search-url=https://registry.dev1.mosip.net/api/v1/Insurance/search mosip.esignet.authenticator.sunbird-rc.kbi.entity-id-field=osid +mosip.sunbird.identity-openid-claims-mapping={"fullName":"fullName","name":"fullName","email":"email","phone":"mobile","gender":"gender","dateOfBirth":"dob","birthdate":"dob"} mosip.esignet.vciplugin.sunbird-rc.enable-psut-based-registry-search=false mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-search-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/search mosip.esignet.vciplugin.sunbird-rc.issue-credential-url=http://demo-registry-credentials-service.sunbird:3000/credentials/issue -mosip.esignet.vciplugin.sunbird-rc.supported-credential-types=LifeInsuranceCredential,InsuranceCredential,VehicleInsuranceCredential -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.static-value-map.issuerId=did:web:api.dev1.mosip.net:identity-service:8ebda1d0-665b-4bb7-abc7-d4bf56b6ee09 -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/insurance-credential.json -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.registry-get-url=https://registry.dev1.mosip.net/api/v1/Insurance/ -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-schema-id=did:schema:e1f8df1d-c46c-483c-a882-3fc823666b9f -mosip.esignet.vciplugin.sunbird-rc.credential-type.InsuranceCredential.cred-schema-version=1.0.0 - -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.static-value-map.issuerId=did:web:api.dev1.mosip.net:identity-service:8ebda1d0-665b-4bb7-abc7-d4bf56b6ee09 -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/life-insurance-credential.json -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.registry-get-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/ -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.cred-schema-id=did:schema:e1f8df1d-c46c-483c-a882-3fc823666b9f -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.cred-schema-version=1.0.0 -mosip.esignet.vciplugin.sunbird-rc.credential-type.LifeInsuranceCredential.registry-search-url=http://demo-registry.sunbird-registry:8081/api/v1/Insurance/search - -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.static-value-map.issuerId=did:web:holashchand.github.io:test_project:32b08ca7-9979-4f42-aacc-1d73f3ac5322 -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.template-url=${spring_config_url_env}/*/${active_profile_env}/${spring_config_label_env}/vehicle-insurance-credential.json -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.registry-get-url=http://10.3.148.107/registry/api/v1/Insurance/ -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.cred-schema-id=did:schema:e95a24f5-d65e-4b65-b497-e0671f8bd12d -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.cred-schema-version=1.0.0 -mosip.esignet.vciplugin.sunbird-rc.credential-type.VehicleInsuranceCredential.registry-search-url=http://10.3.148.107/registry/api/v1/Insurance/search \ No newline at end of file +mosip.esignet.sunbird-rc.registry-get-url=https://registry.dev1.mosip.net/api/v1/Insurance/ \ No newline at end of file