Giter Club home page Giter Club logo

ccd-case-document-am-api's Introduction

ccd-case-document-am-api

API v1 Build Status Docker Build Status License: MIT

Purpose

The purpose of this application is to act as a proxy document management service to facilitate following access controls on case documents:

  1. Applying CCD's configured access control policies to the upload of CCD case documents.

  2. Applying CCD's configured access control policies to the download of CCD case documents.

  3. Protecting against unauthorised access to CCD case documents while being uploaded to, stored in, and downloaded from the case document repository. In both cases, access control will be applied as if the document were a 'standard' item of case data contained within the CCD case data store.

Users & services with sufficient permissions only will be able to upload, modify, delete and download documents.

Prerequisites

This service works with the DocStore Api and CaseData Api alongside their databases CCD Data Store and Document Management Store.

Environment variables

The following environment variables are required:

Name Default Description
  |CASE_DOCUMENT_S2S_AUTHORISED_SERVICES| ccd_case_document_am_api, ccd_gw, xui_webapp, ccd_data, bulk_scan_processor, bulk_scan_orchestrator|
  |REFORM_SERVICE_NAME| ccd-case-document-am-api|
  |REFORM_TEAM| ccd
  |REFORM_ENVIRONMENT| local
  |S2S_SECRET|
  |S2S_KEY| S2S_KEY
  |CCD_DOCUMENT_API_IDAM_KEY|
  |DEFINITION_STORE_HOST|
  |USER_PROFILE_HOST|
  |DM_STORE_BASE_URL| http://dm-store:8080|
  |CCD_DATA_STORE_API_BASE_URL| http://ccd-data-store-api:4452|
  |app-insights-connection-string|
  |IDAM_USER_URL| http://idam-api:5000 |
  |IDAM_S2S_URL| http://service-auth-provider-api:8080|
  |JAVA_TOOL_OPTIONS| -XX:InitialRAMPercentage=30.0 -XX:MaxRAMPercentage=65.0 -XX:MinRAMPercentage=30.0 -XX:+UseConcMarkSweepGC -agentlib:jdwp=transport=dt_socket, server=y,suspend=n,address=5005

Building the application

The project uses Gradle as a build tool. It already contains ./gradlew wrapper script, so there's no need to install gradle.

To build the project execute the following command:

  ./gradlew build

To clean up your environment use the following, it will delete any temporarily generated files such as reports.

  ./gradlew clean

Running

If you want your code to become available to other Docker projects (e.g. for local environment testing), you need to build the image:

docker-compose build

When the project has been packaged in target/ directory, you can run it by executing following command:

docker-compose up

As a result the following containers will get created and started:

  • API exposing port 4455

Endpoints

Authorization and ServiceAuthorization (S2S) tokens are required in the headers for all endpoints. All APIs are authorised with some service level permissions captured in the the configurables rules under service_config.json file (https://github.com/hmcts/ccd-case-document-am-api/blob/readme_update/src/main/resources/service_config.json).

GET /cases/documents/{documentId}
  • Retrieves json representation of the document metadata from doc-store.
GET /cases/documents/{documentId}/binary
  • Streams contents of the most recent Document Content Version associated with the Stored Document.
GET /cases/documents/{documentId}/token
  • Returns the hashed token required for document upload functionality. Initially this API is reserved only for the bulk_scan_processor service.
POST /cases/documents
  • Used for uploading any case related documents to doc-store.

      Also requires a request body containing
      - classification {string}
      - files {multipart/form-data}
      - caseTypeId {string}
      - jurisdictionId {string}
    
PATCH /cases/documents/{documentId}
  • Used to update the TTL(time to live) value for any case related document in doc-store.

      Also requires a request body containing
      - ttl {string}
    
PATCH /cases/documents/attachToCase
  • Will be exposed only for ccd-data-store application and utilised in a service to service call for attaching documents to their corresponding case while submitting case create/update with document.

      Also requires a request body containing
      - CaseDocumentMetadata {objects}
    
DELETE /cases/documents/{documentId}
  • Will delete any case related documents from doc-store

      Also requires a request param for
      - permanent {boolean}
    

Functional Tests

The functional tests are located in functionalTest folder. These are the tests run against an environment. For example if you would like to test your local environment you'll need to export the following variables on your .bash_profile script.

#Smoke/Functional Tests
export BEFTA_S2S_CLIENT_ID=ccd_gw
export BEFTA_S2S_CLIENT_SECRET=AAAAAAAAAAAAAAAC
export BEFTA_RESPONSE_HEADER_CHECK_POLICY=JUST_WARN
export CASE_DOC_AM_URL=http://localhost:4455
export DM_STORE_URL=http://localhost:4506
export CCD_BEFTA_CITIZEN_2_PWD=Pa55word11
export CCD_BEFTA_CASEWORKER_2_SOLICITOR_1_PWD=Pa55word11
export DM_STORE_BASE_URL=http://localhost:4506
export BEFTA_S2S_CLIENT_ID_OF_CCD_DATA=ccd_data
export BEFTA_S2S_CLIENT_SECRET_OF_CCD_DATA=AAAAAAAAAAAAAAAB
export CASE_DOCUMENT_AM_URL=http://localhost:4455
export BEFTA_S2S_CLIENT_ID_OF_BULK_SCAN_PROCESSOR=bulk_scan_processor
export BEFTA_S2S_CLIENT_SECRET_OF_BULK_SCAN_PROCESSOR=AAAAAAAAAAAAAAAA
export CCD_DATA_STORE_API_BASE_URL=http://localhost:4452
export CCD_DM_DOMAIN=http://localhost:4455
export BEFTA_S2S_CLIENT_ID_OF_XUI_WEBAPP=xui_webapp
export BEFTA_S2S_CLIENT_SECRET_OF_XUI_WEBAPP=AAAAAAAAAAAAAAAA
export DM_STORE_BASE_URL=http://localhost:4506

These tests also rely on the CCD_BEFTA_JURISDICTION2.xlsx file to be already imported. This file should be available in your local environment already.

####Running the tests

In order to run the tests you will need to pull down ccd-docker repo and checkout the AM-CCD_Docker_Custom_Setup_For_Case_Document_API branch.

Then pull down ccd-case-document-utilities repo and update the following lines in env-main.sh to match your local file structure.

###### Please provide Docker project location please
DOCKER_REPO='/Users/{username}/HMCTS-Projects/AM/ccd-docker'
###### Please provide "ccd-case-document-utilities/auto-environment/idam-ui-automation" location
WEB_REPO='/Users/{username}/HMCTS-Projects/AM/ccd-case-document-utilities/auto-environment/idam-ui-automation'
###### Please provide "ccd-case-document-utilities/auto-environment/bin" location
CURRENT_LOCATION='/Users/736062/HMCTS-Projects/AM/ccd-case-document-utilities/auto-environment/bin'

Run the scripts that follow. Once this is done, try to run your functional tests.

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.

ccd-case-document-am-api's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ccd-case-document-am-api's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • Update actions/cache action to v4
  • Update actions/checkout action to v4
  • Update actions/setup-java action to v4
  • Update dependency com.github.ben-manes.caffeine:caffeine to v3
  • Update dependency com.github.hmcts:befta-fw to v20
  • Update dependency com.github.hmcts:ccd-test-definitions to v8
  • Update dependency com.github.hmcts:idam-java-client to v3
  • Update dependency com.github.hmcts:service-auth-provider-java-client to v5
  • Update dependency com.google.guava:guava to v33
  • Update dependency io.github.openfeign:feign-httpclient to v13
  • Update dependency net.javacrumbs.json-unit:json-unit-assertj to v3
  • Update dependency org.json:json to v20240303
  • Update dependency org.springframework.retry:spring-retry to v2
  • Update dependency org.springframework:spring-context-support to v6
  • Update dependency pmd to v7
  • Update hmctspublic.azurecr.io/base/java Docker tag to v21
  • Update io.rest-assured:4.3.1 to v5 (major) (io.rest-assured:xml-path, io.rest-assured:json-path)
  • Update openjdk Docker tag to v21
  • Update plugin net.serenity-bdd.serenity-gradle-plugin to v4
  • Update plugin org.sonarqube to v5
  • Update spring boot to v3 (major) (org.springframework.boot:spring-boot-starter-oauth2-resource-server, org.springframework.boot:spring-boot-starter-oauth2-client, org.springframework.boot)
  • Update spring cloud to v4 (major) (org.springframework.cloud:spring-cloud-starter-contract-stub-runner, org.springframework.cloud:spring-cloud-starter-openfeign)
  • Update stefanzweifel/git-auto-commit-action action to v5
  • Update tibdex/github-app-token action to v2
  • Update versions.restAssured to v5 (major) (io.rest-assured:xml-path, io.rest-assured:json-path, io.rest-assured:rest-assured)
  • Update versions.tomcatEmbedded to v10 (major) (org.apache.tomcat.embed:tomcat-embed-websocket, org.apache.tomcat.embed:tomcat-embed-el, org.apache.tomcat.embed:tomcat-embed-core)
  • ๐Ÿ” Create all pending approval PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

  • Update All patch-minor dependencies (azurerm, gradle, hashicorp/terraform, microsoft/ApplicationInsights-Java, openjdk, org.apache.httpcomponents:httpclient, org.codehaus.groovy:groovy-json, org.codehaus.groovy:groovy-xml, org.codehaus.groovy:groovy, com.google.guava:guava, io.rest-assured:xml-path, io.rest-assured:json-path, com.github.hmcts:fortify-client, org.springframework.cloud:spring-cloud-starter-contract-stub-runner, org.assertj:assertj-vavr, com.github.hmcts:befta-fw, com.github.hmcts:ccd-test-definitions, net.javacrumbs.json-unit:json-unit-assertj, org.glassfish:jakarta.el, ch.qos.logback:logback-core, ch.qos.logback:logback-classic, com.nimbusds:nimbus-jose-jwt, net.minidev:json-smart, io.github.openfeign:feign-httpclient, io.jsonwebtoken:jjwt, org.springframework.boot:spring-boot-starter-oauth2-resource-server, org.springframework.boot:spring-boot-starter-oauth2-client, com.github.ben-manes.caffeine:caffeine, commons-io:commons-io, org.apache.commons:commons-lang3, jacoco, pmd, au.com.dius.pact.provider:junit5spring, au.com.dius.pact.provider:spring, au.com.dius.pact.provider:junit5, au.com.dius.pact.consumer:java8, au.com.dius.pact.consumer:junit5, org.apache.tomcat.embed:tomcat-embed-websocket, org.apache.tomcat.embed:tomcat-embed-el, org.apache.tomcat.embed:tomcat-embed-core, io.rest-assured:rest-assured, org.springframework.cloud:spring-cloud-starter-openfeign, org.springframework:spring-context-support, com.github.hmcts.java-logging:logging, org.projectlombok:lombok, org.junit.jupiter:junit-jupiter-engine, org.junit.jupiter:junit-jupiter-params, org.junit.jupiter:junit-jupiter-api, net.serenity-bdd.serenity-gradle-plugin, au.com.dius.pact, com.github.spacialcircumstances.gradle-cucumber-reporting, org.sonarqube, com.github.ben-manes.versions, uk.gov.hmcts.java, org.springframework.boot, info.solidsoft.pitest, io.spring.dependency-management)

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • openjdk 17-jdk-slim
  • hmctspublic.azurecr.io/base/java 17-distroless
github-actions
.github/workflows/dependency-check.yml
  • tibdex/github-app-token v1
  • actions/checkout v3
  • actions/cache v1
  • actions/setup-java v3
  • stefanzweifel/git-auto-commit-action v4
.github/workflows/swagger.yml
  • actions/checkout v3
  • actions/cache v3
  • actions/setup-java v3
gradle
build.gradle
  • io.spring.dependency-management 1.0.13.RELEASE
  • info.solidsoft.pitest 1.5.0
  • org.springframework.boot 2.7.12
  • uk.gov.hmcts.java 0.12.43
  • com.github.ben-manes.versions 0.36.0
  • org.sonarqube 4.2.0.3129
  • com.github.spacialcircumstances.gradle-cucumber-reporting 0.1.23
  • au.com.dius.pact 4.1.7
  • net.serenity-bdd.serenity-gradle-plugin 3.0.0
  • pmd 6.21.0
  • jacoco 0.8.8
  • commons-fileupload:commons-fileupload 1.5
  • org.apache.commons:commons-lang3 3.7
  • commons-io:commons-io 2.8.0
  • org.springframework:spring-context-support 5.3.27
  • com.github.ben-manes.caffeine:caffeine 2.7.0
  • commons-beanutils:commons-beanutils 1.9.4
  • org.json:json 20200518
  • org.projectlombok:lombok 1.18.20
  • com.github.hmcts.java-logging:logging 6.0.1
  • com.github.hmcts:service-auth-provider-java-client 3.1.4
  • com.github.hmcts:idam-java-client 1.5.5
  • org.springframework.retry:spring-retry 1.3.4
  • org.springframework.boot:spring-boot-starter-oauth2-client 2.5.14
  • org.springframework.boot:spring-boot-starter-oauth2-resource-server 2.5.14
  • io.jsonwebtoken:jjwt 0.9.1
  • io.github.openfeign:feign-httpclient 11.0
  • org.apache.httpcomponents:httpclient 4.5.13
  • javax.inject:javax.inject 1
  • io.springfox:springfox-boot-starter 3.0.0
  • org.springframework.cloud:spring-cloud-starter-openfeign 3.1.3
  • net.minidev:json-smart 2.4.7
  • io.vavr:vavr 0.10.4
  • com.nimbusds:nimbus-jose-jwt 9.21
  • org.apache.tomcat.embed:tomcat-embed-core 9.0.82
  • org.apache.tomcat.embed:tomcat-embed-el 9.0.82
  • org.apache.tomcat.embed:tomcat-embed-websocket 9.0.82
  • ch.qos.logback:logback-classic 1.2.10
  • ch.qos.logback:logback-core 1.2.10
  • org.glassfish:jakarta.el 4.0.1
  • com.microsoft.azure:applicationinsights-spring-boot-starter 2.6.4
  • org.junit.jupiter:junit-jupiter-api 5.6.2
  • org.junit.jupiter:junit-jupiter-params 5.6.2
  • org.junit.jupiter:junit-jupiter-engine 5.6.2
  • net.javacrumbs.json-unit:json-unit-assertj 2.27.0
  • com.github.hmcts:ccd-test-definitions 7.13.0
  • com.github.hmcts:befta-fw 8.7.11
  • commons-lang:commons-lang 2.6
  • org.assertj:assertj-vavr 0.4.2
  • org.springframework.cloud:spring-cloud-starter-contract-stub-runner 2.2.2.RELEASE
  • io.rest-assured:rest-assured 4.3.1
  • io.rest-assured:json-path 4.3.1
  • io.rest-assured:xml-path 4.3.1
  • com.github.hmcts:fortify-client 1.3.0
  • au.com.dius.pact.consumer:junit5 4.1.7
  • au.com.dius.pact.consumer:java8 4.1.7
  • au.com.dius.pact.provider:junit5 4.1.7
  • au.com.dius.pact.provider:spring 4.1.7
  • au.com.dius.pact.provider:junit5spring 4.1.7
  • org.bouncycastle:bcpkix-jdk15on 1.70
  • io.rest-assured:json-path 4.3.1
  • io.rest-assured:xml-path 4.3.1
  • com.google.guava:guava 30.1-jre
  • org.codehaus.groovy:groovy 3.0.7
  • org.codehaus.groovy:groovy-xml 3.0.7
  • org.codehaus.groovy:groovy-json 3.0.7
  • org.apache.httpcomponents:httpclient 4.5.13
gradle/suppress.gradle
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.2.1
helm-values
charts/ccd-case-document-am-api/values.yaml
helmv3
charts/ccd-case-document-am-api/Chart.yaml
  • java 5.2.0
regex
Dockerfile
  • microsoft/ApplicationInsights-Java 3.4.13
terraform
infrastructure/main.tf
infrastructure/state.tf
  • azurerm ~> 3.45.0
terraform-version
infrastructure/.terraform-version
  • hashicorp/terraform 1.3.9

  • Check this box to trigger a request for Renovate to run again on this repository

Use of mutation testing in ccd-case-document-am-api - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool Pit in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

We apologize if you have already received message multiple times or if you have already had the opportunity to complete the survey. If you have already shared your feedback, we want to convey our appreciation, kindly disregard this message, and please accept our apologies for any inconvenience.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.