Skip to content

Commit

Permalink
[ES-1806] Updated the mapping of claims
Browse files Browse the repository at this point in the history
Signed-off-by: Venkata Saidurga Polamraju <[email protected]>
  • Loading branch information
pvsaidurga committed Dec 2, 2024
1 parent 260e2a5 commit 87ad3e5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String,String> oidcClaimsMapping;

@Autowired
private RestTemplate restTemplate;

Expand Down Expand Up @@ -181,12 +184,13 @@ private Map<String,Object> fetchRegistryObject(String entityUrl) throws KycExcha

public Map<String, Object> buildKycDataBasedOnPolicy(Map<String, Object> credentialSubject, List<String> claims, String[] locales) {
Map<String, Object> 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;
Expand Down
22 changes: 2 additions & 20 deletions sunbird-rc-plugin/src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
mosip.esignet.sunbird-rc.registry-get-url=https://registry.dev1.mosip.net/api/v1/Insurance/
22 changes: 2 additions & 20 deletions sunbird-rc-plugin/src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
mosip.esignet.sunbird-rc.registry-get-url=https://registry.dev1.mosip.net/api/v1/Insurance/

0 comments on commit 87ad3e5

Please sign in to comment.