From 005df8577510435245ae1220e6c90e42735940c6 Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Thu, 27 Jul 2023 16:06:02 +0530 Subject: [PATCH 1/6] API for Update Verified Credential --- docker-compose.yml | 3 +- .../controller/RegistryEntityController.java | 38 +++++++++---------- .../service/impl/RegistryServiceImpl.java | 26 +++++++------ 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8b49b3986..be53598aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,12 +2,13 @@ version: "2.4" services: es: - image: docker.elastic.co/elasticsearch/elasticsearch:8.8.1 + image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0 environment: - discovery.type=single-node - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - ELASTIC_PASSWORD=${ELASTIC_SEARCH_PASSWORD} - xpack.security.enabled=${ELASTIC_SECURITY_ENABLED-false} + - logger.level=DEBUG ports: - "9200:9200" - "9300:9300" diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java index 5b29c2af9..4aadfe9ba 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java @@ -244,11 +244,12 @@ public ResponseEntity putEntity( watch.start(tag); JsonNode existingNode = registryHelper.readEntity(newRootNode, userId); String emailId = registryHelper.fetchEmailIdFromToken(request, entityName); - registryHelper.updateEntityAndState(existingNode, newRootNode, userId); if (existingNode.get(entityName).has(OSSystemFields._osSignedData.name())) { registryHelper.revokeExistingCredentials(entityName, entityId, userId, existingNode.get(entityName).get(OSSystemFields._osSignedData.name()).asText("")); } + registryHelper.updateEntityAndState(existingNode, newRootNode, userId); + registryHelper.invalidateAttestation(entityName, entityId, userId, null); registryHelper.autoRaiseClaim(entityName, entityId, userId, existingNode, newRootNode, emailId); responseParams.setErrmsg(""); @@ -258,7 +259,7 @@ public ResponseEntity putEntity( return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); response = new Response(Response.API_ID.PUT, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -269,7 +270,6 @@ public ResponseEntity putEntity( } } - @RequestMapping(value = "/api/v1/{entityName}", method = RequestMethod.POST) public ResponseEntity postEntity( @PathVariable String entityName, @@ -308,7 +308,7 @@ public ResponseEntity postEntity( return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); response = new Response(Response.API_ID.POST, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (MiddlewareHaltException e) { @@ -360,7 +360,7 @@ public ResponseEntity updatePropertyOfTheEntity( watch.stop(tag); return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); response = new Response(Response.API_ID.PUT, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -384,8 +384,8 @@ public ResponseEntity addNewPropertyToTheEntity( checkEntityNameInDefinitionManager(entityName); registryHelper.authorize(entityName, entityId, request); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); - response = new Response(Response.API_ID.POST, "ERROR", responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); + response = new Response(Response.API_ID.POST, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { return createUnauthorizedExceptionResponse(e); @@ -461,8 +461,8 @@ public ResponseEntity getEntityWithConsent( } return new ResponseEntity<>(HttpStatus.NOT_FOUND); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); - Response response = new Response(Response.API_ID.GET, "ERROR", responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); + Response response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { logger.error("Error in partner api access", e); @@ -512,9 +512,9 @@ public ResponseEntity getEntityType(@PathVariable String entityName, checkEntityNameInDefinitionManager(entityName); registryHelper.authorizeAttestor(entityName, request); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); - response = new Response(Response.API_ID.GET, "ERROR", responseParams); - return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); + createSchemaNotFoundResponse(re.getMessage(), responseParams); + response = new Response(Response.API_ID.GET, "ERROR", responseParams); + return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception exceptionFromAuthorizeAttestor) { return new ResponseEntity<>(HttpStatus.FORBIDDEN); } @@ -605,7 +605,7 @@ public ResponseEntity getEntity( return new ResponseEntity<>(node, HttpStatus.OK); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); + createSchemaNotFoundResponse(re.getMessage(), responseParams); response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -665,7 +665,7 @@ public ResponseEntity getEntityByToken(@PathVariable String entityName, return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(),responseParams); + createSchemaNotFoundResponse(e.getMessage(),responseParams); response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -683,7 +683,7 @@ public ResponseEntity getEntityForAttestation( @PathVariable String entity, @PathVariable String entityId ) { - ResponseParams responseParams = new ResponseParams(); + ResponseParams responseParams = new ResponseParams(); try { JsonNode resultNode = registryHelper.readEntity("", entity, entityId, false, null, false); ObjectNode objectNode = objectMapper.createObjectNode(); @@ -696,7 +696,7 @@ public ResponseEntity getEntityForAttestation( return new ResponseEntity<>(objectNode, HttpStatus.OK); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); + createSchemaNotFoundResponse(re.getMessage(), responseParams); Response response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } @@ -719,7 +719,7 @@ public ResponseEntity attestEntity( try { checkEntityNameInDefinitionManager(entityName); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(),responseParams); + createSchemaNotFoundResponse(re.getMessage(),responseParams); Response response = new Response(Response.API_ID.PATCH, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } @@ -811,7 +811,7 @@ public ResponseEntity getSignedEntityByToken(@PathVariable String entity return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); + createSchemaNotFoundResponse(re.getMessage(), responseParams); response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -900,4 +900,4 @@ public ResponseEntity revokeACredential ( return new ResponseEntity<>(response,HttpStatus.INTERNAL_SERVER_ERROR); } } -} +} \ No newline at end of file diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index cee15e2f7..007da2546 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -17,8 +17,8 @@ import dev.sunbirdrc.registry.middleware.util.Constants; import dev.sunbirdrc.registry.middleware.util.JSONUtil; import dev.sunbirdrc.registry.middleware.util.OSSystemFields; -import dev.sunbirdrc.registry.model.event.Event; import dev.sunbirdrc.registry.model.EventType; +import dev.sunbirdrc.registry.model.event.Event; import dev.sunbirdrc.registry.service.*; import dev.sunbirdrc.registry.sink.DatabaseProvider; import dev.sunbirdrc.registry.sink.OSGraph; @@ -33,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -326,8 +325,8 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin HashMap uuidVertexMap = vr.getUuidVertexMap(); // Merge the new changes - JsonNode mergedNode = mergeWrapper("/" + parentEntityType, (ObjectNode) readNode, (ObjectNode) inputNode); - logger.debug("After merge the payload is " + mergedNode.toString()); + //JsonNode mergedNode = mergeWrapper("/" + parentEntityType, (ObjectNode) readNode, (ObjectNode) inputNode); + //logger.debug("After merge the payload is " + mergedNode.toString()); // TODO: need to revoke and re-sign the entity // Re-sign, i.e., remove and add entity signature again /* @@ -346,11 +345,7 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin */ // TODO - Validate before update - JsonNode validationNode = mergedNode.deepCopy(); - List removeKeys = new LinkedList<>(); - removeKeys.add(uuidPropertyName); - removeKeys.add(Constants.TYPE_STR_JSON_LD); - JSONUtil.removeNodes((ObjectNode) validationNode, removeKeys); + // iValidate.validate(entityNodeType, mergedNode.toString()); // logger.debug("Validated payload before update"); @@ -362,11 +357,11 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin JSONUtil.trimPrefix((ObjectNode) inputNode, uuidPropertyName, prefix); } - if (!skipSignature) { + if (!skipSignature) { generateCredentials(inputNode, entityType); } - if (entityType.equals(Schema)) { + if (entityType.equals(Schema)) { schemaService.validateUpdateSchema(readNode, inputNode); } @@ -376,8 +371,14 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin if (entityType.equals(Schema)) { schemaService.updateSchema(inputNode); } - databaseProvider.commitTransaction(graph, tx); + JsonNode mergedNode = mergeWrapper("/" + parentEntityType, (ObjectNode) readNode, (ObjectNode) inputNode); + logger.debug("After merge the payload is " + mergedNode.toString()); + JsonNode validationNode = mergedNode.deepCopy(); + List removeKeys = new LinkedList<>(); + removeKeys.add(uuidPropertyName); + removeKeys.add(Constants.TYPE_STR_JSON_LD); + JSONUtil.removeNodes((ObjectNode) validationNode, removeKeys); if (isInternalRegistry(entityType) && isElasticSearchEnabled()) { if (addShardPrefixForESRecord && !shard.getShardLabel().isEmpty()) { @@ -389,6 +390,7 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin JSONUtil.removeNodesByPath(mergedNode.get(entityType), definitionsManager.getExcludingFieldsForEntity(entityType))); callESActors(nodeWithPublicData, "UPDATE", entityType, id, tx); } + auditService.auditUpdate( auditService.createAuditRecord(userId, rootId, tx, entityType), shard, mergedNode, readNode); From 93ddef3d7376ad9c78863fa9a19135eb9771c54e Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Thu, 27 Jul 2023 17:57:16 +0530 Subject: [PATCH 2/6] API for update verified credential --- docker-compose.yml | 1 + docker-compose.yml.save | 283 ++++++++++++++++++ .../controller/RegistryEntityController.java | 4 - .../registry/entities/UpdateCredential.java | 20 ++ .../service/impl/RegistryServiceImpl.java | 1 - 5 files changed, 304 insertions(+), 5 deletions(-) create mode 100644 docker-compose.yml.save create mode 100644 java/registry/src/main/java/dev/sunbirdrc/registry/entities/UpdateCredential.java diff --git a/docker-compose.yml b/docker-compose.yml index be53598aa..b39426f88 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -290,6 +290,7 @@ services: image: redis:latest ports: - "6379:6379" + digilocker-certificate-api: image: dockerhub/sunbird-rc-digilocker-certificate-api volumes: diff --git a/docker-compose.yml.save b/docker-compose.yml.save new file mode 100644 index 000000000..ca360d9de --- /dev/null +++ b/docker-compose.yml.save @@ -0,0 +1,283 @@ +version: "2.4" + +services: + es: + image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 + environment: + - discovery.type=single-node + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + - ELASTIC_PASSWORD= + - xpack.security.enabled=false + ports: + - "9200:9200" + - "9300:9300" + healthcheck: + test: [ "CMD", "curl", "-f", "localhost:9200/_cluster/health", "--header", "Authorization: Basic ZWxhc3RpYzpEa0llZFBQU0Ni" ] + interval: 30s + timeout: 10s + retries: 4 + db: + image: postgres + volumes: + - ./${DB_DIR-db-data}:/var/lib/postgresql/data + ports: + - "5432:5432" + environment: + - POSTGRES_DB=registry + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres" ] + interval: 10s + timeout: 5s + retries: 5 + registry: + image: dockerhub/sunbird-rc-core:latest + volumes: + - ./schema:/home/sunbirdrc/config/public/_schemas + environment: + - connectionInfo_uri=jdbc:postgresql://db:5432/registry + - connectionInfo_username=postgres + - connectionInfo_password=postgres + - elastic_search_connection_url=es:9200 + - elastic_search_auth_enabled=false + - elastic_search_username= + - elastic_search_password= + - search_providerName=dev.sunbirdrc.registry.service.ElasticSearchService + - sunbird_sso_realm=sunbird-rc + - sunbird_sso_url=http://keycloak:8080/auth + - sunbird_sso_admin_client_id=admin-api + - sunbird_sso_client_id=registry-frontend + - sunbird_sso_admin_client_secret=45678 + - claims_url=http://claim-ms:8082 + - sign_url=http://certificate-signer:8079/sign + - verify_url=http://certificate-signer:8079/verify + - sign_health_check_url=http://certificate-signer:8079/health + - signature_enabled=true + - pdf_url=http://certificate-api:8078/api/v1/certificatePDF + - certificate_health_check_url=http://certificate-api:8078/health + - template_base_url=http://registry:8081/api/v1/templates/ #Looks for certificate templates for pdf copy of the signed certificate + - sunbird_keycloak_user_set_password=true + - filestorage_connection_url=http://file-storage:9000 + - filestorage_access_key=admin + - filestorage_secret_key=12345678 + - filestorage_bucket_key=issuance + - registry_base_apis_enable=false + - sunbird_keycloak_user_password=abcd@123 + - logging.level.root=INFO + - enable_external_templates=true + - async_enabled=false + - authentication_enabled=true + - kafka_bootstrap_address=kafka:9092 + - webhook_enabled=false + - webhook_url=http://localhost:5001/api/v1/callback + - redis_host=redis + - redis_port=6379 + - manager_type=DefinitionsManager + ports: + - "8081:8081" + depends_on: + es: + condition: service_healthy + db: + condition: service_healthy + healthcheck: + test: [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8081/health || exit 1" ] + interval: 30s + timeout: 10s + retries: 10 + keycloak: + image: dockerhub/sunbird-rc-keycloak:latest + volumes: + - ./imports:/opt/jboss/keycloak/imports + environment: + - DB_VENDOR=postgres + - DB_ADDR=db + - DB_PORT=5432 + - DB_DATABASE=registry + - DB_USER=postgres + - DB_PASSWORD=postgres + - KEYCLOAK_USER=admin + - KEYCLOAK_PASSWORD=admin + - KEYCLOAK_IMPORT=/opt/jboss/keycloak/imports/realm-export.json + - PROXY_ADDRESS_FORWARDING=true + - KEYCLOAK_LOGO=https://raw.githubusercontent.com/Sunbird-RC/demo-education-registry/federated_edu_registry/imports/ndearLogo.svg + - KEYCLOAK_PORTAL_TITLE=Education + - KEYCLOAK_PORTAL_SUB_TITLE= + - VALIDATE_NONCE=false + - KEYCLOAK_URL=http://localhost:8080/auth + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:9990/ || exit 1"] + interval: 30s + timeout: 10s + retries: 5 + ports: + - "8080:8080" + - "9990:9990" + depends_on: + - db + claim-ms: + image: dockerhub/sunbird-rc-claim-ms:${RELEASE_VERSION} + environment: + - connectionInfo_uri=jdbc:postgresql://db:5432/registry + - connectionInfo_username=postgres + - connectionInfo_password=postgres + - sunbirdrc_url=http://registry:8081 + ports: + - "8082:8082" + depends_on: + db: + condition: service_started + registry: + condition: service_started + healthcheck: + test: [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8082/health || exit 1" ] + interval: 30s + timeout: 10s + retries: 10 + certificate-signer: + image: dockerhub/sunbird-rc-certificate-signer:${RELEASE_VERSION} + environment: + - PORT=8079 + ports: + - "8079:8079" + volumes: + - ./imports:/etc/signer + healthcheck: + test: + [ "CMD-SHELL", "curl -f http://localhost:8079/health || exit 1" ] + interval: 30s + timeout: 10s + retries: 10 + certificate-api: + image: dockerhub/sunbird-rc-certificate-api:${RELEASE_VERSION} + environment: + - PORT=8078 + ports: + - "8078:8078" + healthcheck: + test: + [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8078/health || exit 1" ] + interval: 30s + timeout: 10s + retries: 10 + file-storage: + image: quay.io/minio/minio + volumes: + - ${HOME}/minio/data:/data + environment: + - MINIO_ROOT_USER=admin + - MINIO_ROOT_PASSWORD=12345678 + command: server --address 0.0.0.0:9000 --console-address 0.0.0.0:9001 /data + ports: + - "9000:9000" + - "9001:9001" + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ] + interval: 30s + timeout: 20s + retries: 10 + notification-ms: + image: dockerhub/sunbird-rc-notification-service:${RELEASE_VERSION} + ports: + - "8765:8765" + healthcheck: + test: + [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8765/notification-service/v1/health || exit 1" ] + interval: 30s + timeout: 10s + retries: 10 + zookeeper: + image: confluentinc/cp-zookeeper:latest + ports: + - "2181:2181" + environment: + ZOOKEEPER_CLIENT_PORT: "2181" + ZOOKEEPER_TICK_TIME: "2000" + kafka: + image: confluentinc/cp-kafka:latest + depends_on: + zookeeper: + condition: service_started + ports: + - "9092:9092" + environment: + KAFKA_BROKER_ID: "1" + KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" + KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:9092,OUTSIDE://localhost:9094" + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT" + KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL" + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "1" + healthcheck: + test: + [ "CMD", "kafka-topics", "--list", "--zookeeper", "zookeeper:2181" ] + interval: 30s + timeout: 10s + retries: 10 + public-key-service: + image: dockerhub/sunbird-rc-public-key-service + environment: + - CONFIG_BASE_PATH=/etc/keys + ports: + - "3300:3300" + healthcheck: + test: [ "CMD", "curl", "-f", "localhost:3300/public-key-service/api/v1/health" ] + interval: 30s + timeout: 10s + retries: 10 + volumes: + - ./imports:/etc/keys + context-proxy-service: + image: dockerhub/sunbird-rc-context-proxy-service + ports: + - "4400:4400" + healthcheck: + test: [ "CMD", "curl", "-f", "localhost:4400/health" ] + interval: 30s + timeout: 10s + retries: 10 + nginx: + image: dockerhub/sunbird-rc-nginx + ports: + - "80:80" + depends_on: + registry: + condition: service_healthy + context-proxy-service: + condition: service_started + public-key-service: + condition: service_started + keycloak: + condition: service_started + claim-ms: + condition: service_started + file-storage: + condition: service_started + healthcheck: + test: [ "CMD", "curl", "-f", "localhost:80" ] + interval: 30s + timeout: 10s + retries: 10 + redis: + image: redis:latest + ports: + - "6379:6379" + digilocker-certificate-api: + image: dockerhub/sunbird-digilocker-certificate-api:latest + volumes: + - ${PWD}/services/digilocker-certificate-api/config/:/go/config/ + ports: + - "8087:8087" + environment: + KEYCLOAK_CLIENT_ID: admin-api + KEYCLOAK_CLIENT_SECRET: ${KEYCLOAK_SECRET} + DIGILOCKER_HMAC_AUTHKEY: ${DIGILOCKER_HMAC_AUTHKEY} + DIGILOCKER_AUTH_KEYNAME: x-digilocker-hmac + PORT: 8087 + bulk_issuance: + image: dockerhub/sunbird-rc-bulk-issuance + ports: + - "5665:5665" + environment: + REGISTRY_BASE_URL: http://registry:8081/ + DATABASE_HOST: db diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java index 4aadfe9ba..44252a833 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java @@ -226,7 +226,6 @@ public ResponseEntity putEntity( String userId = USER_ANONYMOUS; if (registryHelper.doesEntityOperationRequireAuthorization(entityName)) { try { - userId = registryHelper.authorize(entityName, entityId, request); } catch (Exception e) { return createUnauthorizedExceptionResponse(e); @@ -237,7 +236,6 @@ public ResponseEntity putEntity( ((ObjectNode) rootNode).put(uuidPropertyName, entityId); ObjectNode newRootNode = objectMapper.createObjectNode(); newRootNode.set(entityName, rootNode); - try { checkEntityNameInDefinitionManager(entityName); String tag = "RegistryController.update " + entityName; @@ -249,13 +247,11 @@ public ResponseEntity putEntity( existingNode.get(entityName).get(OSSystemFields._osSignedData.name()).asText("")); } registryHelper.updateEntityAndState(existingNode, newRootNode, userId); - registryHelper.invalidateAttestation(entityName, entityId, userId, null); registryHelper.autoRaiseClaim(entityName, entityId, userId, existingNode, newRootNode, emailId); responseParams.setErrmsg(""); responseParams.setStatus(Response.Status.SUCCESSFUL); watch.stop(tag); - return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/entities/UpdateCredential.java b/java/registry/src/main/java/dev/sunbirdrc/registry/entities/UpdateCredential.java new file mode 100644 index 000000000..02be9f107 --- /dev/null +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/entities/UpdateCredential.java @@ -0,0 +1,20 @@ +package dev.sunbirdrc.registry.entities; + +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@Builder +@EqualsAndHashCode +public class UpdateCredential { + private String entity; + private String entityId; + private String attestationProperty; + private String attestationPropertyId; + private String signedData; + private String signedHash; + private String userId; +} + + diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index 007da2546..adaa78594 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -382,7 +382,6 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin if (isInternalRegistry(entityType) && isElasticSearchEnabled()) { if (addShardPrefixForESRecord && !shard.getShardLabel().isEmpty()) { - // Replace osid with shard details String prefix = shard.getShardLabel() + RecordIdentifier.getSeparator(); JSONUtil.addPrefix((ObjectNode) mergedNode, prefix, new ArrayList<>(Collections.singletonList(uuidPropertyName))); } From 23f2cea70a6afdcc641533336b19b1cdd36dc731 Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Wed, 11 Oct 2023 12:15:01 +0530 Subject: [PATCH 3/6] resolve formating issue --- .../controller/RegistryEntityController.java | 40 ++++++++++--------- .../service/impl/RegistryServiceImpl.java | 7 ++-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java index 44252a833..5b29c2af9 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java @@ -226,6 +226,7 @@ public ResponseEntity putEntity( String userId = USER_ANONYMOUS; if (registryHelper.doesEntityOperationRequireAuthorization(entityName)) { try { + userId = registryHelper.authorize(entityName, entityId, request); } catch (Exception e) { return createUnauthorizedExceptionResponse(e); @@ -236,26 +237,28 @@ public ResponseEntity putEntity( ((ObjectNode) rootNode).put(uuidPropertyName, entityId); ObjectNode newRootNode = objectMapper.createObjectNode(); newRootNode.set(entityName, rootNode); + try { checkEntityNameInDefinitionManager(entityName); String tag = "RegistryController.update " + entityName; watch.start(tag); JsonNode existingNode = registryHelper.readEntity(newRootNode, userId); String emailId = registryHelper.fetchEmailIdFromToken(request, entityName); + registryHelper.updateEntityAndState(existingNode, newRootNode, userId); if (existingNode.get(entityName).has(OSSystemFields._osSignedData.name())) { registryHelper.revokeExistingCredentials(entityName, entityId, userId, existingNode.get(entityName).get(OSSystemFields._osSignedData.name()).asText("")); } - registryHelper.updateEntityAndState(existingNode, newRootNode, userId); registryHelper.invalidateAttestation(entityName, entityId, userId, null); registryHelper.autoRaiseClaim(entityName, entityId, userId, existingNode, newRootNode, emailId); responseParams.setErrmsg(""); responseParams.setStatus(Response.Status.SUCCESSFUL); watch.stop(tag); + return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); response = new Response(Response.API_ID.PUT, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -266,6 +269,7 @@ public ResponseEntity putEntity( } } + @RequestMapping(value = "/api/v1/{entityName}", method = RequestMethod.POST) public ResponseEntity postEntity( @PathVariable String entityName, @@ -304,7 +308,7 @@ public ResponseEntity postEntity( return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); response = new Response(Response.API_ID.POST, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (MiddlewareHaltException e) { @@ -356,7 +360,7 @@ public ResponseEntity updatePropertyOfTheEntity( watch.stop(tag); return new ResponseEntity<>(response, HttpStatus.OK); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); response = new Response(Response.API_ID.PUT, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -380,8 +384,8 @@ public ResponseEntity addNewPropertyToTheEntity( checkEntityNameInDefinitionManager(entityName); registryHelper.authorize(entityName, entityId, request); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); - response = new Response(Response.API_ID.POST, "ERROR", responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); + response = new Response(Response.API_ID.POST, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { return createUnauthorizedExceptionResponse(e); @@ -457,8 +461,8 @@ public ResponseEntity getEntityWithConsent( } return new ResponseEntity<>(HttpStatus.NOT_FOUND); } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(), responseParams); - Response response = new Response(Response.API_ID.GET, "ERROR", responseParams); + createSchemaNotFoundResponse(e.getMessage(), responseParams); + Response response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { logger.error("Error in partner api access", e); @@ -508,9 +512,9 @@ public ResponseEntity getEntityType(@PathVariable String entityName, checkEntityNameInDefinitionManager(entityName); registryHelper.authorizeAttestor(entityName, request); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); - response = new Response(Response.API_ID.GET, "ERROR", responseParams); - return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); + createSchemaNotFoundResponse(re.getMessage(), responseParams); + response = new Response(Response.API_ID.GET, "ERROR", responseParams); + return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception exceptionFromAuthorizeAttestor) { return new ResponseEntity<>(HttpStatus.FORBIDDEN); } @@ -601,7 +605,7 @@ public ResponseEntity getEntity( return new ResponseEntity<>(node, HttpStatus.OK); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); + createSchemaNotFoundResponse(re.getMessage(), responseParams); response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -661,7 +665,7 @@ public ResponseEntity getEntityByToken(@PathVariable String entityName, return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } } catch (RecordNotFoundException e) { - createSchemaNotFoundResponse(e.getMessage(),responseParams); + createSchemaNotFoundResponse(e.getMessage(),responseParams); response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -679,7 +683,7 @@ public ResponseEntity getEntityForAttestation( @PathVariable String entity, @PathVariable String entityId ) { - ResponseParams responseParams = new ResponseParams(); + ResponseParams responseParams = new ResponseParams(); try { JsonNode resultNode = registryHelper.readEntity("", entity, entityId, false, null, false); ObjectNode objectNode = objectMapper.createObjectNode(); @@ -692,7 +696,7 @@ public ResponseEntity getEntityForAttestation( return new ResponseEntity<>(objectNode, HttpStatus.OK); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); + createSchemaNotFoundResponse(re.getMessage(), responseParams); Response response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } @@ -715,7 +719,7 @@ public ResponseEntity attestEntity( try { checkEntityNameInDefinitionManager(entityName); } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(),responseParams); + createSchemaNotFoundResponse(re.getMessage(),responseParams); Response response = new Response(Response.API_ID.PATCH, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } @@ -807,7 +811,7 @@ public ResponseEntity getSignedEntityByToken(@PathVariable String entity return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } } catch (RecordNotFoundException re) { - createSchemaNotFoundResponse(re.getMessage(), responseParams); + createSchemaNotFoundResponse(re.getMessage(), responseParams); response = new Response(Response.API_ID.GET, "ERROR", responseParams); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } catch (Exception e) { @@ -896,4 +900,4 @@ public ResponseEntity revokeACredential ( return new ResponseEntity<>(response,HttpStatus.INTERNAL_SERVER_ERROR); } } -} \ No newline at end of file +} diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index adaa78594..63f2987d2 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -357,11 +357,11 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin JSONUtil.trimPrefix((ObjectNode) inputNode, uuidPropertyName, prefix); } - if (!skipSignature) { + if (!skipSignature) { generateCredentials(inputNode, entityType); } - if (entityType.equals(Schema)) { + if (entityType.equals(Schema)) { schemaService.validateUpdateSchema(readNode, inputNode); } @@ -371,6 +371,7 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin if (entityType.equals(Schema)) { schemaService.updateSchema(inputNode); } + databaseProvider.commitTransaction(graph, tx); JsonNode mergedNode = mergeWrapper("/" + parentEntityType, (ObjectNode) readNode, (ObjectNode) inputNode); logger.debug("After merge the payload is " + mergedNode.toString()); @@ -382,6 +383,7 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin if (isInternalRegistry(entityType) && isElasticSearchEnabled()) { if (addShardPrefixForESRecord && !shard.getShardLabel().isEmpty()) { + // Replace osid with shard details String prefix = shard.getShardLabel() + RecordIdentifier.getSeparator(); JSONUtil.addPrefix((ObjectNode) mergedNode, prefix, new ArrayList<>(Collections.singletonList(uuidPropertyName))); } @@ -389,7 +391,6 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin JSONUtil.removeNodesByPath(mergedNode.get(entityType), definitionsManager.getExcludingFieldsForEntity(entityType))); callESActors(nodeWithPublicData, "UPDATE", entityType, id, tx); } - auditService.auditUpdate( auditService.createAuditRecord(userId, rootId, tx, entityType), shard, mergedNode, readNode); From 02c5f39ce3fbfae9058a252644fdc54bd6bb19cd Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Thu, 12 Oct 2023 16:28:28 +0530 Subject: [PATCH 4/6] update Verified Credential --- docker-compose.yml | 2 +- .../sunbirdrc/registry/controller/RegistryEntityController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b39426f88..41d24a0f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "2.4" services: es: - image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0 + image: docker.elastic.co/elasticsearch/elasticsearch:8.8.1 environment: - discovery.type=single-node - "ES_JAVA_OPTS=-Xms512m -Xmx512m" diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java index 5b29c2af9..3eedf9426 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java @@ -244,11 +244,11 @@ public ResponseEntity putEntity( watch.start(tag); JsonNode existingNode = registryHelper.readEntity(newRootNode, userId); String emailId = registryHelper.fetchEmailIdFromToken(request, entityName); - registryHelper.updateEntityAndState(existingNode, newRootNode, userId); if (existingNode.get(entityName).has(OSSystemFields._osSignedData.name())) { registryHelper.revokeExistingCredentials(entityName, entityId, userId, existingNode.get(entityName).get(OSSystemFields._osSignedData.name()).asText("")); } + registryHelper.updateEntityAndState(existingNode, newRootNode, userId); registryHelper.invalidateAttestation(entityName, entityId, userId, null); registryHelper.autoRaiseClaim(entityName, entityId, userId, existingNode, newRootNode, emailId); responseParams.setErrmsg(""); From 4c2fd373445105876adbc49aab4448c46243cdd5 Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Wed, 25 Oct 2023 17:02:46 +0530 Subject: [PATCH 5/6] deleted docker-compose.yml.save --- docker-compose.yml.save | 283 ---------------------------------------- 1 file changed, 283 deletions(-) delete mode 100644 docker-compose.yml.save diff --git a/docker-compose.yml.save b/docker-compose.yml.save deleted file mode 100644 index ca360d9de..000000000 --- a/docker-compose.yml.save +++ /dev/null @@ -1,283 +0,0 @@ -version: "2.4" - -services: - es: - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 - environment: - - discovery.type=single-node - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - - ELASTIC_PASSWORD= - - xpack.security.enabled=false - ports: - - "9200:9200" - - "9300:9300" - healthcheck: - test: [ "CMD", "curl", "-f", "localhost:9200/_cluster/health", "--header", "Authorization: Basic ZWxhc3RpYzpEa0llZFBQU0Ni" ] - interval: 30s - timeout: 10s - retries: 4 - db: - image: postgres - volumes: - - ./${DB_DIR-db-data}:/var/lib/postgresql/data - ports: - - "5432:5432" - environment: - - POSTGRES_DB=registry - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres - healthcheck: - test: [ "CMD-SHELL", "pg_isready -U postgres" ] - interval: 10s - timeout: 5s - retries: 5 - registry: - image: dockerhub/sunbird-rc-core:latest - volumes: - - ./schema:/home/sunbirdrc/config/public/_schemas - environment: - - connectionInfo_uri=jdbc:postgresql://db:5432/registry - - connectionInfo_username=postgres - - connectionInfo_password=postgres - - elastic_search_connection_url=es:9200 - - elastic_search_auth_enabled=false - - elastic_search_username= - - elastic_search_password= - - search_providerName=dev.sunbirdrc.registry.service.ElasticSearchService - - sunbird_sso_realm=sunbird-rc - - sunbird_sso_url=http://keycloak:8080/auth - - sunbird_sso_admin_client_id=admin-api - - sunbird_sso_client_id=registry-frontend - - sunbird_sso_admin_client_secret=45678 - - claims_url=http://claim-ms:8082 - - sign_url=http://certificate-signer:8079/sign - - verify_url=http://certificate-signer:8079/verify - - sign_health_check_url=http://certificate-signer:8079/health - - signature_enabled=true - - pdf_url=http://certificate-api:8078/api/v1/certificatePDF - - certificate_health_check_url=http://certificate-api:8078/health - - template_base_url=http://registry:8081/api/v1/templates/ #Looks for certificate templates for pdf copy of the signed certificate - - sunbird_keycloak_user_set_password=true - - filestorage_connection_url=http://file-storage:9000 - - filestorage_access_key=admin - - filestorage_secret_key=12345678 - - filestorage_bucket_key=issuance - - registry_base_apis_enable=false - - sunbird_keycloak_user_password=abcd@123 - - logging.level.root=INFO - - enable_external_templates=true - - async_enabled=false - - authentication_enabled=true - - kafka_bootstrap_address=kafka:9092 - - webhook_enabled=false - - webhook_url=http://localhost:5001/api/v1/callback - - redis_host=redis - - redis_port=6379 - - manager_type=DefinitionsManager - ports: - - "8081:8081" - depends_on: - es: - condition: service_healthy - db: - condition: service_healthy - healthcheck: - test: [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8081/health || exit 1" ] - interval: 30s - timeout: 10s - retries: 10 - keycloak: - image: dockerhub/sunbird-rc-keycloak:latest - volumes: - - ./imports:/opt/jboss/keycloak/imports - environment: - - DB_VENDOR=postgres - - DB_ADDR=db - - DB_PORT=5432 - - DB_DATABASE=registry - - DB_USER=postgres - - DB_PASSWORD=postgres - - KEYCLOAK_USER=admin - - KEYCLOAK_PASSWORD=admin - - KEYCLOAK_IMPORT=/opt/jboss/keycloak/imports/realm-export.json - - PROXY_ADDRESS_FORWARDING=true - - KEYCLOAK_LOGO=https://raw.githubusercontent.com/Sunbird-RC/demo-education-registry/federated_edu_registry/imports/ndearLogo.svg - - KEYCLOAK_PORTAL_TITLE=Education - - KEYCLOAK_PORTAL_SUB_TITLE= - - VALIDATE_NONCE=false - - KEYCLOAK_URL=http://localhost:8080/auth - healthcheck: - test: ["CMD-SHELL", "curl -f http://localhost:9990/ || exit 1"] - interval: 30s - timeout: 10s - retries: 5 - ports: - - "8080:8080" - - "9990:9990" - depends_on: - - db - claim-ms: - image: dockerhub/sunbird-rc-claim-ms:${RELEASE_VERSION} - environment: - - connectionInfo_uri=jdbc:postgresql://db:5432/registry - - connectionInfo_username=postgres - - connectionInfo_password=postgres - - sunbirdrc_url=http://registry:8081 - ports: - - "8082:8082" - depends_on: - db: - condition: service_started - registry: - condition: service_started - healthcheck: - test: [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8082/health || exit 1" ] - interval: 30s - timeout: 10s - retries: 10 - certificate-signer: - image: dockerhub/sunbird-rc-certificate-signer:${RELEASE_VERSION} - environment: - - PORT=8079 - ports: - - "8079:8079" - volumes: - - ./imports:/etc/signer - healthcheck: - test: - [ "CMD-SHELL", "curl -f http://localhost:8079/health || exit 1" ] - interval: 30s - timeout: 10s - retries: 10 - certificate-api: - image: dockerhub/sunbird-rc-certificate-api:${RELEASE_VERSION} - environment: - - PORT=8078 - ports: - - "8078:8078" - healthcheck: - test: - [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8078/health || exit 1" ] - interval: 30s - timeout: 10s - retries: 10 - file-storage: - image: quay.io/minio/minio - volumes: - - ${HOME}/minio/data:/data - environment: - - MINIO_ROOT_USER=admin - - MINIO_ROOT_PASSWORD=12345678 - command: server --address 0.0.0.0:9000 --console-address 0.0.0.0:9001 /data - ports: - - "9000:9000" - - "9001:9001" - healthcheck: - test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ] - interval: 30s - timeout: 20s - retries: 10 - notification-ms: - image: dockerhub/sunbird-rc-notification-service:${RELEASE_VERSION} - ports: - - "8765:8765" - healthcheck: - test: - [ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8765/notification-service/v1/health || exit 1" ] - interval: 30s - timeout: 10s - retries: 10 - zookeeper: - image: confluentinc/cp-zookeeper:latest - ports: - - "2181:2181" - environment: - ZOOKEEPER_CLIENT_PORT: "2181" - ZOOKEEPER_TICK_TIME: "2000" - kafka: - image: confluentinc/cp-kafka:latest - depends_on: - zookeeper: - condition: service_started - ports: - - "9092:9092" - environment: - KAFKA_BROKER_ID: "1" - KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" - KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:9092,OUTSIDE://localhost:9094" - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT" - KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "1" - healthcheck: - test: - [ "CMD", "kafka-topics", "--list", "--zookeeper", "zookeeper:2181" ] - interval: 30s - timeout: 10s - retries: 10 - public-key-service: - image: dockerhub/sunbird-rc-public-key-service - environment: - - CONFIG_BASE_PATH=/etc/keys - ports: - - "3300:3300" - healthcheck: - test: [ "CMD", "curl", "-f", "localhost:3300/public-key-service/api/v1/health" ] - interval: 30s - timeout: 10s - retries: 10 - volumes: - - ./imports:/etc/keys - context-proxy-service: - image: dockerhub/sunbird-rc-context-proxy-service - ports: - - "4400:4400" - healthcheck: - test: [ "CMD", "curl", "-f", "localhost:4400/health" ] - interval: 30s - timeout: 10s - retries: 10 - nginx: - image: dockerhub/sunbird-rc-nginx - ports: - - "80:80" - depends_on: - registry: - condition: service_healthy - context-proxy-service: - condition: service_started - public-key-service: - condition: service_started - keycloak: - condition: service_started - claim-ms: - condition: service_started - file-storage: - condition: service_started - healthcheck: - test: [ "CMD", "curl", "-f", "localhost:80" ] - interval: 30s - timeout: 10s - retries: 10 - redis: - image: redis:latest - ports: - - "6379:6379" - digilocker-certificate-api: - image: dockerhub/sunbird-digilocker-certificate-api:latest - volumes: - - ${PWD}/services/digilocker-certificate-api/config/:/go/config/ - ports: - - "8087:8087" - environment: - KEYCLOAK_CLIENT_ID: admin-api - KEYCLOAK_CLIENT_SECRET: ${KEYCLOAK_SECRET} - DIGILOCKER_HMAC_AUTHKEY: ${DIGILOCKER_HMAC_AUTHKEY} - DIGILOCKER_AUTH_KEYNAME: x-digilocker-hmac - PORT: 8087 - bulk_issuance: - image: dockerhub/sunbird-rc-bulk-issuance - ports: - - "5665:5665" - environment: - REGISTRY_BASE_URL: http://registry:8081/ - DATABASE_HOST: db From f5c70caa48b6a7597738394347b426e8720ef617 Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Wed, 25 Oct 2023 17:07:49 +0530 Subject: [PATCH 6/6] reverted RegistryServiceImpl --- .../sunbirdrc/registry/service/impl/RegistryServiceImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index e764cc194..4ac9631fc 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -318,10 +318,6 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin } String parentEntityType = readNode.fields().next().getKey(); HashMap uuidVertexMap = vr.getUuidVertexMap(); - - // Merge the new changes - //JsonNode mergedNode = mergeWrapper("/" + parentEntityType, (ObjectNode) readNode, (ObjectNode) inputNode); - //logger.debug("After merge the payload is " + mergedNode.toString()); // TODO: need to revoke and re-sign the entity // Re-sign, i.e., remove and add entity signature again /*